Board index » delphi » TClientDataSet -> exception: EDBClient 'Field Value Required.'
Jason Summers
![]() Delphi Developer |
TClientDataSet -> exception: EDBClient 'Field Value Required.'2004-04-30 12:53:31 PM delphi44 IDE: Delphi 7 Enterprise Database: Interbase 6 Problem: In my Interbase table, I have a unique # (Primary Key) assigned to each record. This record value is filled in with a trigger/generator combination. The trigger is fired BEFORE INSERT: CREATE TRIGGER SET_CLIENTS_CLIENTID FOR CLIENTS BEFORE INSERT POSITION 0 AS BEGIN NEW.CLIENTID = GEN_ID(GEN_CLIENTS_CLIENTID, 1); END The table CLIENTS is structured like this: ----------------------------------------- CLIENTID INTEGER NOT NULL, (Primary Key) FIRSTNAME VARCHAR(21), LASTNAME VARCHAR(21), ... // other fields, address, city, etc. I am using the TClientDataSet and TProvider components. The TClientDataSet does not allow me to post a new record into it is in-memory dataset. The first error I received is this: Exception: EDatabaseError - Field 'CLIENTID' must have a value I went to the TClientDataSet Fields Editor and added the TFields. I then edited the CLIENTID TField instance and set it is Required to False. Now I get the error 'EDBClient 'Field Value Required.' No other fields in the CLIENTS table need values; they are all fields like first name, last name, dob, etc. None are keyed, all can be null and do not require values. Funny thing is, I can go ahead and give CLIENTID any value, say 99, and it will work just fine. The trigger seems to overwrite whatever value I throw in the TClientDataSet. I would like to be able to add records to the ClientDataSet without setting the CLIENTID field to some fake value, since this is the 'right' way to do it. I've tried messing the the TFieldDefs, but I think these are only used in CreateDataSet method, and since my dataset is already created these didn't seem to help either. I've tried linking the TProvider to bother dbExpress and Interbase Express. I don't think these matter, since it won't let me post to the ClientDataSet anyways. Thanks for help in advance - Jason |