In TIBCTable.OnBeforePost I have this code:
Code: Select all
if DataSet.FieldByName('MyFieldX').asString = '' then
DataSet.FieldByName('MyFieldX').Clear;
Now I want to insert a new record:
This works:
Code: Select all
AIBCTable.Insert;
AIBCTable.FieldByName('Field1').asString := 'Test';
AIBCTable.FieldByName('MyFieldX').asString := 'X34B';
AIBCTable.Post;
Code: Select all
AIBCTable.Insert;
AIBCTable.FieldByName('Field1').asString := 'Test';
AIBCTable.Post;
Code: Select all
violation of FOREIGN KEY constraint "FK_EXAMPLE" on table "MyTable"
Foreign key reference target does not exist
Problematic key value is ("MyFieldX" = '').