Recent

Author Topic: SQLite: records do not save [SOLVED]  (Read 3014 times)

vice

  • New Member
  • *
  • Posts: 28
SQLite: records do not save [SOLVED]
« on: October 14, 2008, 04:12:45 am »
What other ways exist to establish a primary key in SQLite?

I use ftAutoInc and it works fine, but if I use the PrimaryKey propertie the records do not save, why?

If I do:

Code: [Select]
Sqlite3Dataset1.ExecSQL('CREATE TABLE tbl (Code INTEGER NOT NULL PRIMARY KEY, First_Name VARCHAR)');

The records do not save either, why?

Best regards.

EDIT:

The solution:

Code: [Select]

  with Sqlite3Dataset1 do
  begin
      TableName := 'tbl';
      PrimaryKey := 'Code';
      AutoIncrementKey := True;
      if not TableExists then
        ExecSQL('CREATE TABLE tbl (Code INTEGER NOT NULL PRIMARY KEY, First_Name VARCHAR)');
  end;

 

TinyPortal © 2005-2018