Hello Mihaela, >I'm having problems with autoincrement fields. >I defined by table's key field as "id" INTEGER PRIMARY KEY AUTOINCREMENT >I'm using it in Delphi 2009 with TClientDataset just like the example with >clientdataset grid. In order to reproduce your problem, I added the AUTOINCREMENT keyword to the create table statement in DISQLite3_ClientDataSet_Grid_Form_Main.pas: DISQLite3Database.Execute( 'CREATE TABLE IF NOT EXISTS Products(' + '"ID" INTEGER PRIMARY KEY AUTOINCREMENT,' + '"Name" TEXT)'); >The problem that I'm having is that when I'm adding new records with a grid >(not using the api, but with DeveloperExpress grid) then the autoincrement >key field doesn't get incremented buy SQLite3 but my id filed is left >empty. Therefore I nedded to implement a "OnNewRecord" evet of TClientDataset >to provide the value for id field. I tried Disqlite3database.LastInsertRowID >function but it always returns zero. Unfortunately I can not reproduce your findings. Inserting a new record using the grid automatically fills the ID column as well. Ccan you please provide a simple example project (source code, no binaries, standard Delphi components only) so I can see what and why it is not working for you? Ralf _______________________________________________ Delphi Inspiration mailing list yunqa@xxxxxxxxxxxxx //www.freelists.org/list/yunqa