473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 2925
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John Crowley | last post by:
I'm having an odd problem with viewstate and a dynamically created control inside a repeater template. Basically, I have a repeater setup like this in the aspx:
1
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am have facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the...
1
by: kanones | last post by:
Hi - I am seeing some performance degradation when I am loading a control dynamically onto a page with multiple other dynamical controls using Page.LoadControl versus dragging and dropping it...
6
by: Steve Booth | last post by:
I have a web form with a button and a placeholder, the button adds a user control to the placeholder (and removes any existing controls). The user control contains a single button. I have done all...
1
by: Jeffrey Todd | last post by:
I have successfully created functionality that mostly models what I'm trying to do - which is dynamically insert controls into a user control (ascx), and insert validation controls, also...
7
by: Samuel | last post by:
Hi, I am building a page that makes use of user control as a templating technique. The following is that I have in mind and it is actually working: Root/ -- login.aspx -- login.aspx.vb --...
3
by: Dotnet Gruven | last post by:
I've built a WebForm with a Table added dynamically in Page_Load when IsPostBack is false. The table includes a couple of TextBoxes, RadioButtonLists and CheckboxLists. On postback, those...
3
by: supvine | last post by:
Hello, I am developing a page that has several custom web user controls that need to be loaded dynamically. Some of the controls are loaded based on the action (button-click) of a different...
1
by: Bob Rock | last post by:
Hello, I'm new to ASP.NET and I've been looking into the topic of dynamically loading (typically accomplished with a LoadControl followed by a MyControl.Controls.Add()) both user controls and...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.