Post by veneff on Jan 25, 2009 14:36:58 GMT -5
I'm having trouble on the "COMMIT TRANSACTION" Query.
Here is the test program:
And here is the displayed output:
Start
Executed select max
Figured next index value
Began transaction
Inserted new data into ShoppingLists
Runtime Error in program 'TestProblem': #SQLiteDataBase EXECUTE( "COMMIT TRANSACTION" )
SQL logic error or missing database
If I remove the 3 lines (not counting the PRINT statements):
The program runs successfully.
Or, if I insert a disconnect and connect sequence just after those lines, the program runs OK.
Why?
Thanks for any help!
Vance
Here is the test program:
CLS
PRINT "Start"
SQLITECONNECT #SQLiteDataBase, "Shopper.dbs"
#SQLiteDataBase EXECUTE( "SELECT MAX( ShoppingListIndex ) AS MaxShoppingListIndex FROM ShoppingLists" )
PRINT "Executed select max"
#CurrentQueryRow = #SQLiteDataBase #NEXTROW()
ShoppingListIndex$ = STR$( (#CurrentQueryRow MaxShoppingListIndex()) + 1 )
PRINT "Figured next index value"
#SQLiteDataBase EXECUTE( "BEGIN TRANSACTION" )
PRINT "Began transaction"
#SQLiteDataBase EXECUTE( "INSERT Into ShoppingLists (CustomerIndex, ShoppingListDate, ShoppingListTime, ShoppingListIndex, CombinedShoppingList ) Values (""1"", ""01/25/2009"", ""12:50:30"", ""1"", ""0"" )" )
PRINT "Inserted new data into ShoppingLists"
#SQLiteDataBase EXECUTE( "COMMIT TRANSACTION" )
PRINT "committed transaction"
#SQLiteDataBase DISCONNECT()
PRINT "End"
END
And here is the displayed output:
Start
Executed select max
Figured next index value
Began transaction
Inserted new data into ShoppingLists
Runtime Error in program 'TestProblem': #SQLiteDataBase EXECUTE( "COMMIT TRANSACTION" )
SQL logic error or missing database
If I remove the 3 lines (not counting the PRINT statements):
#SQLiteDataBase EXECUTE( "SELECT MAX( ShoppingListIndex ) AS MaxShoppingListIndex FROM ShoppingLists" )
PRINT "Executed select max"
#CurrentQueryRow = #SQLiteDataBase #NEXTROW()
ShoppingListIndex$ = STR$( (#CurrentQueryRow MaxShoppingListIndex()) + 1 )
PRINT "Figured next index value"
The program runs successfully.
Or, if I insert a disconnect and connect sequence just after those lines, the program runs OK.
Why?
Thanks for any help!
Vance