SQLite Update Problem

Discussion in 'Questions (Windows Mobile)' started by david, Oct 9, 2007.

  1. david

    david Member Licensed User

    Hi Erel,

    I am having difficulty getting any sql updates to work.:sign0085:

    Please see the following code:


    Sub btnInsert_Click
    ' Temporary Code To Check Database Inserts or Updates (Depending On What has been commented out). This is only test code!

    ' Command.CommandText = "Insert Into LogNumber(Lognum, Descrip) Values('" & txtLogNum.Text &"', '" & txtLocation.Text & "')"

    ' Command.CommandText = "Insert Into LogNumber(Lognum, Descrip) Values( 'Test Number', 'Test Description' )"

    Command.CommandText "Update LogNumber Set Descrip = 'New Description'"

    Command.ExecuteNonQuery
    End Sub

    The lines that have been commented out work fine when they are compiled in.

    That is I can insert records through variables or actual strings.

    I cannot update successfully whether or not I use variables or strings or a "Where" condition.

    It does work at the prompt with sqlite3 in a windows command window, so it is not a database issue?

    Am I doing something wrong?

    Also can you point me to code that tells me how to capture sql database exceptions and provide the appropriate error messages.

    Thank you very much.

    Regards,

    David
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    I've checked this code (on the desktop and the device) and it works properly:
    Code:
    Cmd.CommandText = "UPDATE table1 SET col2 = 'new value' WHERE col1 = '136'" 
            Cmd.ExecuteNonQuery
    You could catch all errors with ErrorLabel.
    What kind of errors do you want to catch?
     
Loading...