Franklin,

I ran into this before ( look in the archives), but , unfortunately, the
ADO recordsets serialized to XML used that old XML schema reduced thingy
that the Dataset can't read.

You can, however, get an ADO (legacy)  Recordset object back from a COM
component (ensuring references are set to the component and ADO 2.6 and
above) through Interop, and load the recordset into the DataSet using a
DataAdapter.

A sample (not tested);

     public DataSet GetAdoData(string SQL)
          {
               COMCOMPONENT.COMClass cc = new COMCOMPONENT.COMClass();//COM
component that returns an ADO 2.6 or 2.7 Recordset

               ADODB.Recordset  rs=cc.GetSomeRecordsetForQuery(SQL);

               DataSet ds = new DataSet("ADOData");

               //Use the DataAdapter to fill the DataSet with the ADO
recordset.
               OleDbDataAdapter da = new OleDbDataAdapter();
               da.Fill(ds,rs,"ADOData");

               //make sure to release the COM components; the runtime will
not decrement the ref counts.
               System.Runtime.InteropServices.Marshal.ReleaseComObject(rs);
               System.Runtime.InteropServices.Marshal.ReleaseComObject(cc);

               return ds;

          }

Hope that helps

Steve Holak
Senior Software Architect

Brokerage Concepts IS Dept.
610-491-4879

email:  [EMAIL PROTECTED]



                    franklin gray
                    <franklin.w.gray@VITALTH        To:     [EMAIL PROTECTED]
                    OUGHT.COM>                      cc:
                    Sent by: dotnet                 Subject:     Re: [DOTNET] Catch 
22... (Recordset to Dataset issue...)
                    discussion
                    <[EMAIL PROTECTED]
                    COM>


                    05/23/2002 10:28 AM
                    Please respond to dotnet
                    discussion






just a guess, but can you get the xml from the recordset and load the xml
into a dataset?

-----Original Message-----
From: Rathna Raj [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 23, 2002 8:52 AM
To: [EMAIL PROTECTED]
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.

Reply via email to