Jump to content

<SOLVED> SQLite query


Recommended Posts

_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 error

I want to insert date on the first colum, ip address on the second colum, test results on the third column

what am I missing???

Edited by diikee
Link to comment
Share on other sites

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

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 by DaRam
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...