Subject | RE: [IBO] Basic question about inserting using TIBOTable |
---|---|
Author | Dmitry Beloshistov |
Post date | 2011-02-09T17:30:28Z |
Hi!
1) Before insert trigger must be defined for table for generate unique ID for each row
2) Turn OFF CheckRequired property in TIBOTable and TIBOQuery.
WBR, Dmitry Beloshistov AKA [-=BDS=-]
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of jacobhavkrog
Sent: Wednesday, February 09, 2011 7:18 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] Basic question about inserting using TIBOTable
Hi - here is another basic question from my migration from BDE to Firebird using IBO
In my app I often use this function to get a table:
function NewTable(const ATableName: string): TIBOTable;
begin
Result := TIBOTable.Create(nil);
with Result do begin
Name := ATableName + 'Table' + IntToStr(n); Inc(n);
DatabaseName := DsaDbName;
TableName := ATableName
end
end;
like in this example:
with NewTable('CenSub') do try
Open;
Insert;
FieldByName('GroupNo').AsInteger := 1;
FieldByName('SubSubNo').AsInteger := 2;
Post;
Close
finally
Free
end;
My problem is that I get an error saying, that the primary key field of the CenSub table must have a value. The field is an autoinc field, so I'd expect it to get a value automatically.
Whats the right way to do this in the IBO world?
Thanks,
Jacob :-)
__________ Information from ESET NOD32 Antivirus, version of virus signature database 5859 (20110209) __________
The message was checked by ESET NOD32 Antivirus.
http://www.esetnod32.ru/.ml
[Non-text portions of this message have been removed]
1) Before insert trigger must be defined for table for generate unique ID for each row
2) Turn OFF CheckRequired property in TIBOTable and TIBOQuery.
WBR, Dmitry Beloshistov AKA [-=BDS=-]
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of jacobhavkrog
Sent: Wednesday, February 09, 2011 7:18 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] Basic question about inserting using TIBOTable
Hi - here is another basic question from my migration from BDE to Firebird using IBO
In my app I often use this function to get a table:
function NewTable(const ATableName: string): TIBOTable;
begin
Result := TIBOTable.Create(nil);
with Result do begin
Name := ATableName + 'Table' + IntToStr(n); Inc(n);
DatabaseName := DsaDbName;
TableName := ATableName
end
end;
like in this example:
with NewTable('CenSub') do try
Open;
Insert;
FieldByName('GroupNo').AsInteger := 1;
FieldByName('SubSubNo').AsInteger := 2;
Post;
Close
finally
Free
end;
My problem is that I get an error saying, that the primary key field of the CenSub table must have a value. The field is an autoinc field, so I'd expect it to get a value automatically.
Whats the right way to do this in the IBO world?
Thanks,
Jacob :-)
__________ Information from ESET NOD32 Antivirus, version of virus signature database 5859 (20110209) __________
The message was checked by ESET NOD32 Antivirus.
http://www.esetnod32.ru/.ml
[Non-text portions of this message have been removed]