Sign in to follow this  
Followers 0
sandeep

SQLITE_EXEC not working

6 posts in this topic

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

Share this post


Link to post
Share on other sites



Post what

MsgBox(1, "", _SQLite_ErrMsg ())

says.

Put that after _Exec

Share this post


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

Share this post


Link to post
Share on other sites

HI I tried ,but still i m not getting things wrking from the script.

Is there any issues with 3.2.4 version.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

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