diikee Posted July 15, 2008 Share Posted July 15, 2008 (edited) _SQLite_Exec(-1,"Create table Testlog (Date,Test,Status);") If Not _SQLite_Exec (-1, "INSERT INTO Testlog VALUES ("& @MDAY &"/" & @MON &"/" & @YEAR &"," & $ip &"," & "Pass" &");") = $SQLITE_OK Then _ MsgBox(16, "SQLite Error", _SQLite_ErrMsg ()) ; Query $iRval = _SQLite_GetTable2d (-1, "SELECT * FROM Testlog;", $aResult, $iRows, $iColumns) If $iRval = $SQLITE_OK Then _SQLite_Display2DResult($aResult) Else MsgBox(16, "SQLite Error: " & $iRval, _SQLite_ErrMsg ()) EndIf! SQLite.au3 Error--> Function: _SQLite_Exec--> Query: INSERT INTO Testlog VALUES (15/07/2008,10.100.47.21,Pass);--> Error: near ".47": syntax errorI want to insert date on the first colum, ip address on the second colum, test results on the third columnwhat am I missing??? Edited July 15, 2008 by diikee Link to comment Share on other sites More sharing options...
DjDeep00 Posted July 15, 2008 Share Posted July 15, 2008 @diikee..You are missing single quotes in your insert statement... Do it like this.. "INSERT INTO Testlog VALUES ('"& @MDAY &"/" & @MON &"/" & @YEAR &"','" & $ip &"','" & "Pass" &"');" Link to comment Share on other sites More sharing options...
diikee Posted July 15, 2008 Author Share Posted July 15, 2008 C:\autoit\vmc.au3 (79) : ==> Unable to parse line.: "INSERT INTO Testlog VALUES ('"& @MDAY &"/" & @MON &"/" & @YEAR &"','" & $ip &"','" & "Pass" &"');" ^ ERROR tried your suggestion and got the above error Link to comment Share on other sites More sharing options...
DaRam Posted July 15, 2008 Share Posted July 15, 2008 (edited) Store the SQL statement in a variable first to ensure you have all values: $SQL = "INSERT INTO Testlog VALUES ('"& @MDAY &"/" & @MON &"/" & @YEAR &"','" & $ip &"','Pass');"If that works, then: If Not _SQLite_Exec (-1, $SQL) = $SQLITE_OK Then MsgBox(16, "SQLite Error", _SQLite_ErrMsg ()) Edited July 15, 2008 by DaRam Link to comment Share on other sites More sharing options...
diikee Posted July 15, 2008 Author Share Posted July 15, 2008 Thanks DaRam Saving the query to a script was a savior... 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