I believe it's possible to temporarily disable an identity column, so you can do inserts and such. I don't remember how to do it on an ADO recordset. I assume that if the ADO recordset isn't enforcing the identity column, the dataset fill method won't complain, but that may not be the case. It should be worth a try.
HTH, Erick ----- Original Message ----- From: "Rathna Raj" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, May 23, 2002 6:52 AM Subject: [DOTNET] Catch 22... (Recordset to Dataset issue...) > I am writing a .NET client for a "legacy" COM+ middle-tier. Data (from > MSSQL Sever 2000) from the middle-tier is returned as ADO Recordsets. > Whenever the client requests for a new entity (like Customer, Vendor, > Items,....), appropriate COM+ business component gets a blank Recordset from > the respective table(s). The business component then adds a new record (by > now Recordset is disconnected), updates the newly added record with certain > default values (there is a bit of business logic involved in updating > default values) and then returns this Recordset to the client. In the .NET > client I convert the Recordset into Dataset using OleDbDataAdapter's Fill > method. > > The problem here is, whenever you do a Fill on the Recordset, whose not-null > fields have null, Fill method fails. I was able to overcome this problem to > certain extent by adding some default values (like " " or 0 or current > date/time, depending on the data type of the field in question) to these > not-null fields. But, when I try to add 0 (or any integer value) to an > IDENTITY column, I get an ADO exception (rightly so)... If I don't update, > Fill fails... This is kind of catch22 situation. Any ideas to fix this > issue (apart from manually creating the Dataset from Recordset)??? > > TIA > > Rathna Raj > Icode > > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.