Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

Recordset load XML

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
john0600 - 03 Feb 2008 23:00 GMT
I'm writing a web service in .NET to work with Delphi clients. Delphi
uses ADO so I want to convert the Dataset to a Recordset and vice-
versa. It appears a Web Service cannot publish a web method with a
Recordset return so I save the RecordSet to an XML string:

       SqlDataAdapter sa = new SqlDataAdapter("Select * FROM " +
table , oConn);
       DataSet ds = new DataSet();
       sa.Fill(ds, table);
       sa.FillSchema(ds.Tables[0], SchemaType.Source);

       Recordset rs = new Recordset();
       rs = ConvertToRecordset(ds.Tables[0]);
       Stream streamObj = new Stream();

       // Save the recordset's XML representation in a stream object
       rs.Save(streamObj, PersistFormatEnum.adPersistXML);

       // Get the string (XML) of the recordset
       string outputXml = streamObj.ReadText(streamObj .Size);

The XML works fine in Delphi. Now I want to make changes and send back
the XML and load into a Recordset or reverse the process. The
Recordset doesn't have a Load method. I'm new to CSharp and am not
sure how to load the xml from ADO into a Recordset. I would like to
avoid using files and load the XML string.  Is there a way of doing
this?

Thanks
John
Misbah Arefin - 04 Feb 2008 00:51 GMT
If recordset is what you want then you can load the xmlstring into a dataset
and then use ConvertToRecordset to get the recordset

Signature

Misbah Arefin

> I'm writing a web service in .NET to work with Delphi clients. Delphi
> uses ADO so I want to convert the Dataset to a Recordset and vice-
[quoted text clipped - 26 lines]
> Thanks
> John
Al Reid - 04 Feb 2008 12:59 GMT
> I'm writing a web service in .NET to work with Delphi clients. Delphi
> uses ADO so I want to convert the Dataset to a Recordset and vice-
[quoted text clipped - 26 lines]
> Thanks
> John

True that it doesn't have a "Load" method, However, the XML can be loaded using the Open method.

Open "Data.XML"

Signature

Al Reid

Nicholas Paldino [.NET/C# MVP] - 04 Feb 2008 18:41 GMT
In addition to the other posts, if you don't want to save to a temporary
file, if you are using a version of ADO that supports the Stream object, you
can create a new Stream instance, call the WriteText method on it (passing
the xml that was passed to you) and then pass that to the Open method on a
new Recordset (resetting the stream pointer before you do, of course).

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> I'm writing a web service in .NET to work with Delphi clients. Delphi
> uses ADO so I want to convert the Dataset to a Recordset and vice-
[quoted text clipped - 26 lines]
> Thanks
> John

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.