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