tbohon Posted June 16, 2011 Share Posted June 16, 2011 (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 June 16, 2011 by tbohon Link to comment Share on other sites More sharing options...
MrMitchell Posted June 16, 2011 Share Posted June 16, 2011 (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 June 16, 2011 by MrMitchell Link to comment Share on other sites More sharing options...
tbohon Posted June 16, 2011 Author Share Posted June 16, 2011 (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 June 16, 2011 by tbohon Link to comment Share on other sites More sharing options...
Zedna Posted June 16, 2011 Share Posted June 16, 2011 Try this: sqlite_update( 'INSERT INTO events VALUES ( "' & $answer & '", "<null>"' ) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
tbohon Posted June 16, 2011 Author Share Posted June 16, 2011 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now