I am trying to build Master-Detail Form using TADODataSet, TDBText for Master Table and TDBGrid for Details Table (something smiller to Orders Form like Master Table includs the order header and Details Table includes the Order Items)
Master primary key is Identity column (autoincreament Field)
When trying to add a new record in Master Table and then trying to add records in Details Table before posting the record in Master Table I get this error "non-nullable column cannot be updated to null" and this happens because the master table primary key value is still not known because I didn't post the master record but if I tried the same scenario except that before I add the details records I posted the Master record then the error doesn't appear.
how to work around this problem?
I am connecting Master Table with Details Table using the following properties : Both DataSets have courser location : Client
Details Table :
- DataSource : Master Table DataSource
- Master Records : Id (Primary key of the master table)
- IndexFieldNames : OrderId (the field in Details Table that indicates to which master record does this detail record belong to)
- Lock Type : BatchOptimistic
Please help me
Thanks in advance Yazan Al-lahham