Page 1 of 1

autoinc fields

Posted: 17.07.2006, 14:17
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

Posted: 17.07.2006, 14:57
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;

Posted: 18.07.2006, 23:51
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?

Posted: 21.07.2006, 09:50
by slai
The error comes by posting the record.
I made the table with the IBExpert and created an generater.

Posted: 21.07.2006, 10:29
by noelc
If you have not already done so, you will need to set the Required property of the generated field to False.