alocin Posted July 7, 2005 Posted July 7, 2005 I'm trying to use SQLite iwith c#, the autoincreement attribute for a field in primary key seems not working properly :-\ the code is //Globals SQLiteClient db; //.....creating table db.Execute("CREATE TABLE tblProva (id INT AUTOINCREMENT ,name VARCHAR( 255 ) NOT NULL ,PRIMARY KEY ( id ) ) "); //.....inserting row db.Execute("INSERT INTO tblProva (nome) VALUES ('ciao')"); //..then the select SQLiteResultSet results; results = db.Execute("SELECT * FROM tblProva "); foreach (ArrayList arr in results.Rows) { foreach(object j in arr) Console.Write("\t" + Convert.ToString(j) ); Console.WriteLine(); } //but it doesn't insert an autoincrement INT into id field!! :confused: , there's undefined value instead... can u help me? Quote
FZelle Posted July 7, 2005 Posted July 7, 2005 If you would have taken a look in the SQLite manual you would have seen, that an autoincrement column is created with db.Execute("CREATE TABLE tblProva (id INTEGER PRIMARY KEY,name VARCHAR( 255 ) NOT NULL) "); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.