ClientDataset and Identity fields

ClientDataset and Identity fields

Post by John » Thu, 19 Feb 2004 08:35:18


I'm using a ClientDataSet called cdCustomers. I have an Identity field as
part of an MSSQL-2000 table called Customerkey. When I insert a record into
my Customer table, such as:

cdCustomers.Insert;
cdCustomers.FieldByName('CustomerName').AsString := 'Wilson Plumbing';
cdCustomers.Post;
cdCustomers.ApplyUpdates(-1);

I get an error message that "CustomerKey must have a value".

TIA,

John
 
 
 

ClientDataset and Identity fields

Post by John » Thu, 19 Feb 2004 10:27:14

I solved the problem by setting the "Required" property of the
Dataset.Customerkey field to false.

If there's another way of doing this, without using persistent fields, I'd
love to hear about it.

John