Delete from SQLlite

Discussion in 'Questions (Windows Mobile)' started by ceaser, Aug 24, 2008.

  1. ceaser

    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
     
  2. Erel

    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:
    Code:
    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
     
  3. ceaser

    ceaser Active Member Licensed User

    Hi Erel

    Thanks for your help:sign0188:

    Thanks
    Michael
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice