Delete from SQLlite

ceaser

Active Member
Licensed User
Hi

Can somebody please tell me what is wrong with the following coding

'erase a job
i=Msgbox ("Are You Sure To Erase The Selected Job? ","Erase Job",cMsgBoxYesNo,cMsgBoxQuestion)
If i=6 Then
text="Delete From Jobs Where JobName = " & quote & ListJobs.Text & quote
'Msgbox (text)
cmd.CommandText=text
cmd.ExecuteNonQuery
con.Close
End If:sign0161:

I am trying to delete a jobname from the SQLLite database.:sign0085:

Thanks
Michael
 

Erel

Administrator
Staff member
Licensed User
What error do you get?
Some tips:
'If i = cYes Then' is more clear than 'If i = 6 Then'.
It is better to use a parameterized query:
B4X:
cmd.[URL="http://www.basic4ppc.com/help/sql/index.html?addparameter"]AddParamter[/URL]("Value1")
cmd.CommandText = "Delete From Jobs Where JobName = @value1"
cmd.SetParameter("Value1",ListJobs.Text)
cmd.ExecuteNonQuery
 
Top