469,609 Members | 1,574 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Dynamically loading raw XML from SQL2K into an XML doc (ASP to C#)

In ASP, I have something like this:

Set conn = Server.CreateObject("ADODB.Connection")
Set cmd = Server.CreateObject("ADODB.Command")
Set adoStream = Server.CreateObject("ADODB.Stream")
conn.Open strConnString
Set cmd.ActiveConnection = conn
cmd.CommandText = strSQL
adoStream.Open
cmd.Properties("Output Stream").Value = adoStream
cmd.Properties("xml root") = "XMLRoot"
cmd.Execute , , adExecuteStream
adoStream.Position = 0
xmlDoc.loadXML adoStream.ReadText()

In C#, I have this so far:

System.Data.OleDb.OleDbConnection objCN = new
System.Data.OleDb.OleDbConnection();
objCN.ConnectionString = ConnString;
objCN.Open();
System.Data.OleDb.OleDbCommand objCmd = new
System.Data.OleDb.OleDbCommand();
objCmd.Connection = objCN;
objCmd.CommandType = CommandType.Text;
objCmd.CommandText = strSQL;
System.Data.OleDb.OleDbDataReader objDR = objCmd.ExecuteReader();

System.Xml.XmlDocument xmlDom = new System.Xml.XmlDocument();
xmlDom.Load(<I need that data reader in some loadable format here>);

Just a regular connection and returning a datareader - but to create an XML
doc, it needs an XmlReader - which DataReader isn't compatible. How can I
take the raw stream from OleDb and load that right into an XML doc?

Any ideas? Thanks in advance...
Nov 15 '05 #1
1 2836
Can anyone help me out - I'm really in a jam here.. :o(

"Frank Drebin" <no*****@imsickofspam.com> wrote in message
news:VI**********************@newssvr28.news.prodi gy.com...
In ASP, I have something like this:

Set conn = Server.CreateObject("ADODB.Connection")
Set cmd = Server.CreateObject("ADODB.Command")
Set adoStream = Server.CreateObject("ADODB.Stream")
conn.Open strConnString
Set cmd.ActiveConnection = conn
cmd.CommandText = strSQL
adoStream.Open
cmd.Properties("Output Stream").Value = adoStream
cmd.Properties("xml root") = "XMLRoot"
cmd.Execute , , adExecuteStream
adoStream.Position = 0
xmlDoc.loadXML adoStream.ReadText()

In C#, I have this so far:

System.Data.OleDb.OleDbConnection objCN = new
System.Data.OleDb.OleDbConnection();
objCN.ConnectionString = ConnString;
objCN.Open();
System.Data.OleDb.OleDbCommand objCmd = new
System.Data.OleDb.OleDbCommand();
objCmd.Connection = objCN;
objCmd.CommandType = CommandType.Text;
objCmd.CommandText = strSQL;
System.Data.OleDb.OleDbDataReader objDR = objCmd.ExecuteReader();

System.Xml.XmlDocument xmlDom = new System.Xml.XmlDocument();
xmlDom.Load(<I need that data reader in some loadable format here>);

Just a regular connection and returning a datareader - but to create an XML doc, it needs an XmlReader - which DataReader isn't compatible. How can I
take the raw stream from OleDb and load that right into an XML doc?

Any ideas? Thanks in advance...

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by John Crowley | last post: by
1 post views Thread by kanones | last post: by
3 posts views Thread by supvine | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.