Jump to content

SQLITE_EXEC not working


Recommended Posts

HI I m trying to insert values toa existing database file, with tables created.

BUt when i trying to update the values from the autoit script,nothing is happeing.

but if try from the command line prompt everything works fine.

Can some body help me on this..

#include <SQLite.au3>

#include <SQLite.dll.au3>

Func SQLITEOPEN()

_SQLite_Startup ()

If @error > 0 Then

MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")

Exit - 1

EndIf

_SQLite_Open ("C:\Program Files\AutoIt3\Extras\SQLite\Colorproof.db3") ; Open a :memory: database

If @error > 0 Then

MsgBox(16, "SQLite Error", "Can't Load Database!")

Exit - 1

EndIf

_SQLite_Exec(-1,"CREATE TABLE Result1 ([TC ID] INTEGER,RESULT VARCHAR(50),REMARKS VARCHAR(50));")

_SQLite_Exec(-1,"INSERT INTO Result1 VALUES (1,'Pass','Working');")

_SQLite_Exec(-1,".output C:\Program Files\AutoIt3\Extras\SQLite\Hello.txt") :rolleyes:

_SQLite_Close ()

_SQLite_Shutdown ()

EndFunc

Link to comment
Share on other sites

Post what

MsgBox(1, "", _SQLite_ErrMsg ())

says.

Put that after _Exec

Link to comment
Share on other sites

Post what

MsgBox(1, "", _SQLite_ErrMsg ())

says.

Put that after _Exec

Hey,

I didnt understand what u told..

But i tried placing the message box under each _exec ..

I dont get anyy error messages..

i m using V.3.2.4.0

Link to comment
Share on other sites

As was pointed out before

_SQLite_Exec(-1,".output C:\Program Files\AutoIt3\Extras\SQLite\Hello.txt")

Isn't valid.

Your code does put data in to a database file it is

_SQLite_Exec(-1,".output C:\Program Files\AutoIt3\Extras\SQLite\Hello.txt")

that is worng run the below code to get the line with errors

#include <SQLite.au3>
#include <SQLite.dll.au3>

SQLITEOPEN();call the function

Func SQLITEOPEN()

_SQLite_Startup ()
If @error > 0 Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit - 1
EndIf
_SQLite_Open ("C:\Program Files\AutoIt3\Extras\SQLite\Colorproof.db3") 
If @error > 0 Then
MsgBox(16, "SQLite Error", "Can't Load Database!")
Exit - 1
EndIf

If NOT _SQLite_Exec(-1,"CREATE TABLE Result1 ([TC ID] INTEGER,RESULT VARCHAR(50),REMARKS VARCHAR(50));") = $SQLITE_OK then Msgbox(0,"Sqlite Error","Line 19 " & _SQLite_ErrMsg ())
If NOT _SQLite_Exec(-1,"INSERT INTO Result1 VALUES (1,'Pass','Working');") = $SQLITE_OK then Msgbox(0,"Sqlite Error", "Line 20 " & _SQLite_ErrMsg ())
If NOT _SQLite_Exec(-1,".output C:\Program Files\AutoIt3\Extras\SQLite\Hello.txt") = $SQLITE_OK then Msgbox(0,"Sqlite Error","Line 21 " & _SQLite_ErrMsg ())  

_SQLite_Close ()
_SQLite_Shutdown ()

EndFunc
Edited by ChrisL
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...