Properly using Interbase Dataset.InsertSQL in Delphi
Posted on 2007-10-18
I use interbase and delphi fairly often. I am trying to insert a record into a table using a dataset and InsertSQL. The primary key (MID) uses a generator and trigger
begin new.MID = Gen_ID(QANES_GENERATOR, 1); end
to behave as an autoincremented value.
I created a dataset in delphi with the INSERTSQL statement reading
"INSERT INTO MYTABLE (FIELD01) VALUES ('TEST')"
and this has been added to the MyDataset.InsertSQL.
When I try to use the following statments
Interbase responds with MID must have a value. Interbase is supposed to assign the value automatically, no? I suppose I could figure out the number by querying the generator and assigning it manually, but I figure I'm doing something wrong.
Perhaps the question should be: Can someone give me an example of inserting a blank, new record with the primary key ID set automatically?