Sign in to follow this  
Followers 0
tbohon

Using InputBox results in SQLite UPDATE command

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0