Additional
AnyDAC
SimpleIAX
Forums
Welcome, Guest
Please Login or Register to post messages. Lost Password?
TADTable with SQLite - AUTOINCREMENT returns negative numbers
(1 viewing) 1 Guest
Go to bottom
TOPIC: TADTable with SQLite - AUTOINCREMENT returns negative numbers
#20056
danf84
Junior Boarder
Posts: 34
graphgraph
Karma: 0
User Offline Click here to see the profile of this user
TADTable with SQLite - AUTOINCREMENT returns negative numbers 2012/02/01 07:33 (3 Months, 2 Weeks ago)
Hello,

I am running into a strange problem when porting my TTable to TADTable.
I have the following SQLite table:
CREATE TABLE ENGINEINPUTBUFFER (LINE_NR INTEGER PRIMARY KEY AUTOINCREMENT, TEXT TEXT)

Here's the DFM of my TADTable:

Code:

object EngineInputTable: TADTable
  AutoCalcFields = False
  IndexFieldNames = 'LINE_NR'
  Connection = EngineInputTableConnection
  UpdateOptions.UpdateTableName = 'ENGINEINPUTBUFFER'
  TableName = 'ENGINEINPUTBUFFER'
  Left = 288
  Top = 142
  object EngineInputTableLINE_NR: TAutoIncField
    FieldName = 'LINE_NR'
  end
  object EngineInputTableTEXT: TMemoField
    FieldName = 'TEXT'
    BlobType = ftMemo
  end
end



When I do:
Code:

    EngineInputTable.Insert;
    EngineInputTable['TEXT'] := 'test';
    EngineInputTable.Post;



My "LINE_NR" field is decremented, instead of incremented. In reality, this seems to be generated from my application because if I restart it, the numbers go -1 -2 -3 again, so second run I get: Exception: [AnyDAC][Phys][SQLite] ERROR: PRIMARY KEY must be unique.

I tried with TADQuery, all is OK there. Am I doing it wrong? This code is exactly how it's used with TTable.

Appreciate your help.

Kind regards, Dan
Logged Logged
Last Edit: 2012/02/01 07:34 By danf84.
The administrator has disabled public write access.
#20057
danf84
Junior Boarder
Posts: 34
graphgraph
Karma: 0
User Offline Click here to see the profile of this user
Re:TADTable with SQLite - AUTOINCREMENT returns negative numbers 2012/02/01 09:18 (3 Months, 2 Weeks ago)
Hi, never mind Had to set AutoGenerateValue arAutoInc.
Logged Logged
The administrator has disabled public write access.
Go to top