SQLiteDataTable, Grid binding, Autoincrement and NULL
Posted: Sat 16 Apr 2011 16:57
I have this table :
I created an SQLiteDataTable for the accounts table and generated the commands using the internal tool. I modified the INSERT command to leave out the account_id completely since it should be auto-assigned.
Here is the INSERT command text :
I bound that to a grid but when I try to add a new row through the grid I get this error :
Is it doing some sort of parameter checking internally? How can I make this work?
Code: Select all
CREATE TABLE "accounts" ("account_id" INTEGER PRIMARY KEY AUTOINCREMENT, "account_name" VARCHAR, "username" VARCHAR, "password" VARCHAR);
Here is the INSERT command text :
Code: Select all
INSERT INTO main.accounts (account_name, username, password) VALUES (:account_name, :username, :password)
I can figure out why it sending *any* value for account_id, or why SQLite won't work with it even if it did. I can execute this SQL directly into the database without a problem and the account_id is assigned as it should be:Column 'account_id' does not allow nulls. Do you want to correct the value ?
Code: Select all
INSERT INTO accounts (account_id,username) VALUES (NULL,'test');