Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running stored procedure - need to convert to XML

Status
Not open for further replies.

dawnyanne

Technical User
Nov 1, 2006
34
GB
Hi
forgive me if this is a silly question but I am very new to C#.
I am running a stored procedure in Oracle and the last thing the procedure does is run a select statement on a temporary table. I need to put the results of this select statement - or from a query into an xml file that I can then use for a Crystal Report. I have tried editing the Select statement to use For XML AUTO at the the end but it doesnt like it. I am also haveing the error cannot write string to XML aswell? Is there an easy way to convert this query into an xml file? I am using streamwrite and Datareader to read the information.

Any help would be very much appreciated!
kind regards
Dawnyanne
 
I'm not aware of how exactly XML AUTO works. However you may want to try using a command.ExecuteScalar since xml is a string. if that doesn't work you can write datatables to xml.
Code:
DataTable table = new DataTable();
table.Load(command.ExecuteReader());
table.WriteXml(...);
if the xml needs to be customized, then you need to do this manually.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top