Thanks for the reply folks. As Franklin mentioned I am getting a Recordset from a COM+ middle-tier. There is no way, I can by-pass this and for all practical reasons, I have no control on the existing middle-tier (at lease for the way the Recordset is obtained). So I wanted a solution at the client side.
I did try getting the XML from the Recordset and try to push it into Dataset. But the XML generated by Recordset is no good for Dataset. Only the columns with not-null values end up getting populated (though schema for all the fields do exist). If I have control at the database level I can set the IDENTITY_INSERT. But here I am talking about a disconnected Recordset, with the client-side cursor. I haven't found a way to turn the identity attribute "off" in the Recordset itself. Even if I do that, when I send the Recordset for saving to database, I am not too sure how the database will behave. Steve, I am using ADO 2.7 and using "Fill" to get the Dataset. Did you mean to say that, You have succeeded in doing Fill to get a Dataset from a Recordset, which had NULL values in it's not-null fields (that's basically getting a Dataset from Recordset, just after calling AddNew() on the Recordset)? Thanks Rathna Raj Icode -----Original Message----- From: Dan Souk [mailto:[EMAIL PROTECTED]] Sent: Friday, May 24, 2002 12:32 AM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Catch 22... (Recordset to Dataset issue...) If you can manage the identities on the client side, you might be able to use SET IDENTITY_INSERT yourtablename ON with a batch of SQL INSERT statemetns to get those values back to the database. Hth, Dan -----Original Message----- From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of Erick Thompson Sent: Thursday, May 23, 2002 1:16 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Catch 22... (Recordset to Dataset issue...) 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. 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.