autoinc fields

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
slai
Senior Boarder
Senior Boarder
Posts: 53
Joined: 07.07.2006, 10:45
Location: office

autoinc fields

Post by slai »

Hey

My next problem :-)

I work with Firebird 1.5 and zeoslib.
i've got an autoinc field (ID) when i append a record in the table and i dont fill a number in the id(autoinc) field then it comes an error. Must i fill in the id field a number or something?

sorry for my english :-)

greets andi
slai
Senior Boarder
Senior Boarder
Posts: 53
Joined: 07.07.2006, 10:45
Location: office

Post by slai »

my source for trying this, the #1 is for a field i don't must fill, like the id (autoinc) field.

function appendrecord(sTablename : String; SLFieldentrys : TStringList):boolean;
var
dbtbl : TZTable;
slFieldlist : TStringList;
i : integer;
begin
slFieldlist := TStringList.Create;
dbtbl := getTable(sTablename);
dbtbl.GetFieldNames(slFieldlist);
dbtbl.Append;
for i := 0 to slFieldlist.Count -1 do begin
if SLFieldentrys <> '#1' then begin
dbtbl.FieldByName(slFieldlist).AsString := SLFieldentrys;
end;
end;
try
dbtbl.Post;
result := true;
except
result := false;
dbtbl.Cancel;
end;
dbtbl := nil;
slFieldlist.Free;
end;
Terence
Zeos Dev Team
Zeos Dev Team
Posts: 141
Joined: 22.09.2005, 14:11
Location: Stuttgart
Contact:

Post by Terence »

I need more details!
How does your table def/ddt look like? How did you realized the autoinc with triggers?
What error exactly raised at which cmd in code?
fabian
slai
Senior Boarder
Senior Boarder
Posts: 53
Joined: 07.07.2006, 10:45
Location: office

Post by slai »

The error comes by posting the record.
I made the table with the IBExpert and created an generater.
noelc
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 13.06.2006, 10:54

Post by noelc »

If you have not already done so, you will need to set the Required property of the generated field to False.
Post Reply