fairyoggy Posted August 16, 2019 Posted August 16, 2019 How to fix it? can't use (AUTO_INCREMENT) dbSecurityConnection = dbConnect( 'sqlite', '123.db') dbExec( dbSecurityConnection, ' CREATE TABLE if not exists `housing` (`houseID` INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(houseID)) ' ) it's 2 line in code above
Moderators IIYAMA Posted August 16, 2019 Moderators Posted August 16, 2019 (edited) @slapz0r Afaik that is the mysql syntax. I can't remember what the syntax was for sql, but probably something like this: https://www.queryexamples.com/sql/table/sql-create-table-with-primary-key-foreign-key-and-autoincrement/ Maybe: `houseID` INT PRIMARY KEY AUTOINCREMENT Or `houseID` AUTOINCREMENT PRIMARY KEY Hmmm, probably trying till you get it right. Still confusing all those different syntaxes... And if that doesn't work out, then you can also manually fix it with a viewer: https://sqlitebrowser.org/ (Stop the resource) Edited August 16, 2019 by IIYAMA 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
fairyoggy Posted August 16, 2019 Author Posted August 16, 2019 1 hour ago, IIYAMA said: @slapz0r Afaik that is the mysql syntax. I can't remember what the syntax was for sql, but probably something like this: https://www.queryexamples.com/sql/table/sql-create-table-with-primary-key-foreign-key-and-autoincrement/ Maybe: `houseID` INT PRIMARY KEY AUTOINCREMENT Or `houseID` AUTOINCREMENT PRIMARY KEY Hmmm, probably trying till you get it right. Still confusing all those different syntaxes... And if that doesn't work out, then you can also manually fix it with a viewer: https://sqlitebrowser.org/ (Stop the resource) @IIYAMA dbExec( dbSecurityConnection, ' CREATE TABLE if not exists `housing` (`houseID` INT PRIMARY KEY AUTOINCREMENT)' ) used this option, but got this error: Why? Indicated that it (INT PRIMARY KEY) The second option throws an error with syntax.
Moderators IIYAMA Posted August 16, 2019 Moderators Posted August 16, 2019 @slapz0r hmm try without autoincrement CREATE TABLE IF NOT exists `housing` (`houseID` INT NOT NULL PRIMARY KEY) or maybe this works as well: CREATE TABLE if not exists `housing` ( `houseID` INT NOT NULL PRIMARY KEY AUTO_INCREMENT ) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Master_MTA Posted June 25, 2020 Posted June 25, 2020 (edited) On 16/08/2019 at 09:49, slapztea said: above On 16/08/2019 at 18:59, IIYAMA said: well i know it's old but i was have same problem and wanna share the solution first create table gonna be 'CREATE TABLE IF NOT EXISTS FullData ( id INTEGER PRIMARY KEY AUTOINCREMENT , dataName TEXT, Data TEXT)' like this and inserting gonna be like this "INSERT INTO FullData(dataName,Data) VALUES('Group' , 'test' )" there is another sol for lazy persons like me "INSERT INTO FullData VALUES(NULL,'Group' , 'test' )" hope it helps Enjoy Edited June 25, 2020 by Master_MTA 2 Skype : 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001 every thing is gonna be alright every thing is gonna be okay it's gonna be a good good life that's what my therapist say
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