dangr82 Posted May 19, 2018 Share Posted May 19, 2018 I have created this function for a database, but I can not make it work. I always have two error messages: "not an error" ... and the file created, in the script directory, does not contain anything. Global $sDBName = "Hen.db" Func DatabaseTable() Local $sConnDB _SQLite_Startup() If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite.dll Can't be Loaded!") Exit -1 EndIf $sConnDB = _SQLite_Open($sDBName) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't Load Database!") Exit -1 EndIf If Not _SQLite_Exec($sDBName, 'CREATE TABLE Animal ("Name", "Age");') = $SQLITE_OK Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) If Not _SQLite_Exec($sDBName, 'INSERT INTO Animale VALUES ("Charlie","5");') = $SQLITE_OK Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", _SQLite_ErrMsg()) _SQLite_Close($sConnDB) _SQLite_Shutdown() EndFunc Link to comment Share on other sites More sharing options...
user4157124 Posted May 19, 2018 Share Posted May 19, 2018 (edited) Table name is Animal, not Animale (as in INSERT statement). Edited May 19, 2018 by user4157124 AUERLO (AutoIt error logger) Link to comment Share on other sites More sharing options...
mikell Posted May 19, 2018 Share Posted May 19, 2018 (edited) You must use the handle of the previously opened database _SQLite_Exec($sConnDB, 'CREATE TABLE Animal ("Name", "Age");') ;etc Edit ... or much simpler, use "-1" Edited May 19, 2018 by mikell dangr82 1 Link to comment Share on other sites More sharing options...
Zedna Posted May 20, 2018 Share Posted May 20, 2018 Also consider using _SQLite_Exec (-1, "COMMIT;") dangr82 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
dangr82 Posted May 20, 2018 Author Share Posted May 20, 2018 10 hours ago, mikell said: You must use the handle of the previously opened database _SQLite_Exec($sConnDB, 'CREATE TABLE Animal ("Name", "Age");') ;etc Edit ... or much simpler, use "-1" Great... Thanks!!! 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