If (Error = 1) Then
** In case Process has been stoped before
L$=CHR(13)+CHR(10)
text$='"The Process was stoped because of an error'+L$+'Do you want to continue the process or start it from the Begining ?'+L$+L$+'To continue the Process select "Yes", and select "No" to start it from the begining.'+L$+'Note that if you start the process from the beginning, all the insertrd data will be deleted"'
flag=32+4+0+0+0
param$=text$+','+CHAR(flag)
MessageEx("","param$")
If (CBK_MsgEx=6) Then
**YES
** Inserting Process will continue after last inserted Record.
Error = 0
Event$ = 'Data Inserting Process has been Resumed.'
Notification$ = 'Info'
RunScript("Show Event")
End
If (CBK_MsgEx=7) Then
**No
** Inserting Process Will start from the beginning
** We need to do a DELETE to empty the table
DELETE$ = 'DELETE FROM Dictionary;'
PluginSet("PlugIn","DELETE$")
PluginRun("PlugIn","UpdateDB")
PluginGet("PlugIn","Deleted")
PluginRun("PlugIn","DBError")
PluginGet("PlugIn","Error$")
If (Deleted = 0) Then
** In Case an Error Occured
Event$ = 'The Table contents can NOT be deleted; An error Occured: ' + Error$
Notification$ = 'Error'
RunScript("Show Event")
Running = 0
Error = 1
Return()
Else
i = 0
Event$ = 'Table contents has been deleted successfully..'
Notification$ = 'Info'
RunScript("Show Event")
Event$ = 'Inserting Data into Database Started.'
Notification$ = 'Info'
RunScript("Show Event")
End
End
Else
End
i = i + 1
If (i = 1) Then
TRANSACTION$ = 'BEGIN TRANSACTION;'
PluginSet("PlugIn","TRANSACTION$")
PluginRun("PlugIn","UpdateDB")
End
EnglishWord$ = StrFromFile(English$,i,1)
PersianWord$ = StrFromFile(Persian$,i,1)
SQLQuery1$ = 'INSERT INTO Dictionary (English,Persian)'
SQLQuery2$ = ' VALUES ("'+EnglishWord$+'","'+PersianWord$+'");'
FinalQuery$ = SQLQuery1$ + SQLQuery2$
PluginSet("PlugIn","FinalQuery$")
PluginRun("PlugIn","UpdateDB")
PluginGet("PlugIn","Updated")
PluginRun("PlugIn","DBError")
PluginGet("PlugIn","Error$")
If (Updated=0) Then
** In Case an Error Occured
Event$ = 'Data Inserting Process Stoped; An error Occured: ' + Error$
Notification$ = 'Error'
RunScript("Show Event")
Running = 0
Error = 1
Return()
Else
End
** Progress Bar Movement **
Status = (i/NOL)*631
Percent = (i/NOL)*100
Percent$ = CHAR(Percent)
If (Percent > 10) Then
If (INT(Percent) = 100) Then
Percent$ = StrCopy(Percent$,1,3)
Else
Percent$ = StrCopy(Percent$,1,5)
End
Else
Percent$ = StrCopy(Percent$,1,4)
End
Percent$ = Percent$ + '%'
DisplayValue("Percent","Percent$")
MoveObject("Bar","X,Y,Status,H")
If (i > NOL) Then
COMMIT$ = 'COMMIT;'
PluginSet("PlugIn","COMMIT$")
PluginRun("PlugIn","UpdateDB")
Event$ = 'Data Inserted Successfully into the Database by ' + Timer$
Notification$ = 'Info'
RunScript("Show Event")
Running = 0
Return()
End
ScriptTimer("Timer2=InsertDataProccess","0")