[DUG] TIBDataset

David O'Brien dave at iccs.co.nz
Wed Mar 15 14:54:27 NZDT 2006


Can someone please give me an example of inserting a new record with the
TIBDataset?

I have a TIBDataset, attached to a DB, with 
SelectSQL = 'Select * from tablename'
RefreshSQL = 'Select * from tablename where ID = :old_ID'
ModifySQL = 'Update tablename Set desc = :desc where ID = :old_ID'
InsertSQL = 'Insert into tablename (desc) values (:desc)
DeleteSQL = 'Delete from tablename where ID = :old_ID
And 
GeneratorField = 'TABLE_ID_GEN -> ID By 1'

Table_ID-Gen is a valid generator in the db, there is also a valid trigger
for that generator in AfterInsert.

This all works fine for DB Components, how do I programmatically do an
Insert?

I assumed that:
 Tablename.Insert ;
 Tablename.FieldByName('Desc').AsString := 'Fred' ;
 Tablename.Post ;
Would do the job but it fails because the ID field never gets set. I thought
this should be dealt with by the db server, or the TIBDataset with the
GeneratorField.

Dave.





More information about the Delphi mailing list