Recordset load XML

J

john0600

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
 
M

Misbah Arefin

If recordset is what you want then you can load the xmlstring into a dataset
and then use ConvertToRecordset to get the recordset
 
A

Al Reid

john0600 said:
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

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

Open "Data.XML"
 
N

Nicholas Paldino [.NET/C# MVP]

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).
 
E

eliza sahoo

XML is a simple and flexible system for defining data formats. This is completely platform independent and adopted everywhere for representing complex documents and data structures. For data transmission on web, its having significant contribution.




Al Reid wrote:

Re: Recordset load XML
04-Feb-08

True that it does not have a "Load" method, However, the XML can be loaded using the Open method.

Open "Data.XML"

--
Al Reid

Previous Posts In This Thread:

If recordset is what you want then you can load the xmlstring into a dataset
If recordset is what you want then you can load the xmlstring into a dataset
and then use ConvertToRecordset to get the recordset

--
Misbah Arefin



:

Re: Recordset load XML
True that it does not have a "Load" method, However, the XML can be loaded using the Open method.

Open "Data.XML"

--
Al Reid

In addition to the other posts, if you don't want to save to a temporary file,
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).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Recordset load XML
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


Submitted via EggHeadCafe - Software Developer Portal of Choice
C# .NET Yahoo Stock Download and Charting
http://www.eggheadcafe.com/tutorial...bc1-95f88500d86b/c-net-yahoo-stock-downl.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top