Jump to content

Using InputBox results in SQLite UPDATE command


Recommended Posts

Using the _SQLite_easy.au3 UDF and trying to get the result of an input box inserted into an SQLite table. Keeps giving me 'Error 19' so I'm obviously missing a step.

Table name is events with two variables, category and details. For a new category I'm inserting the constant <null> for the details field.

Here is my code:

$answer = InputBox("Create New Entry ...", "Enter category for new record:  " )

If stringLen($answer) > 0 Then
     sqlite_update( "INSERT INTO events VALUES ( $answer, "<null>" )
EndIf

Any thoughts, pointers or suggestions would be MOST appreciated.

TIA.

Tom

Edited by tbohon
Link to comment
Share on other sites

Using the _SQLite_easy.au3 UDF and trying to get the result of an input box inserted into an SQLite table. Keeps giving me 'Error 19' so I'm obviously missing a step.

Table name is events with two variables, category and details. For a new category I'm inserting the constant <null> for the details field.

Here is my code:

$answer = InputBox("Create New Entry ...", "Enter category for new record:  " )

If stringLen($answer) > 0 Then
    sqlite_update( "INSERT INTO events VALUES ( $answer, "<null>" )
EndIf

Any thoughts, pointers or suggestions would be MOST appreciated.

TIA.

Tom

Problem with the quotes and parenthesis in your line?

sqlite_update( "INSERT INTO events VALUES ( $answer, "<null>" )

Try something like: sqlite_update( 'INSERT INTO events VALUES ( $answer, "<null>" )')

Edited by MrMitchell
Link to comment
Share on other sites

I'll give that a shot and let you know.

FYI I also see the following error showing up when this happens:

!   SQLite.au3 Error
--> Function: _SQLite_Exec
--> Query:    Insert into infokeep values ( $answer, '<empty>' );
--> Error:    infokeep.category may not be NULL

Category (where $answer is supposed to go) is defined as TEXT with attributes UNIQUE and NOT NULL in the SQLite database.

Seems to think that $answer isn't a string and is, in fact, null even though a check with the IsString command shows a result of '1' (true).

Most puzzling.

Edited by tbohon
Link to comment
Share on other sites

Thanks Zedna - that was really close (AutoIt complained about matching quotes), the final solution was this:

sqlite_update( "INSERT INTO events VALUES('" & $answer & "', '<null>');")

REALLY appreciate the help from both of you ... THANK YOU!!!!!

Best,

Tom

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...