Need help - Array to XML doc

  • Thread starter Thread starter Jim H
  • Start date Start date
J

Jim H

I am on a project where I am supposed to send an XML document to a SQL
Server stored procedure.

The XML Doc is a list strings. If in my c# function I get a list values as
(string[] psValueList), how would I create an XML document from that. I am
assuming that the XML doc will be treated as a table of values in the stored
procedure.

Am I even asking the right question ro am I way off track?

Jim
 
Hi Jim,

Is your XML document list string xml format?
If it is, you can read your XML document into a stream, then you can use
DataSet.ReadXml(Stream) to convert it into a dataset.
At last, you can use DataSet.WriteXml to generate a xml file.

For your problem of passing XML document to SQL Server Stored procedure, I
think you need expressing it more details.
What is the content of the xml file?

If it is used for updating the database, I think you should convert it as a
dataset and use SqlDataAdapter's update method to update the database.

If it is used as some parameters of the stored procedure, you should set
the SqlCommand's commandtype to StoredProcedure and pass it into the
parameters collection of the stored procedure.

Hope this helps,
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Jim H" <[email protected]>
| Subject: Need help - Array to XML doc
| Date: Mon, 6 Oct 2003 19:45:21 -0400
| Lines: 13
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <##[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: crlspr-24.233.164.226.myacc.net 24.233.164.226
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP0
8.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:189407
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I am on a project where I am supposed to send an XML document to a SQL
| Server stored procedure.
|
| The XML Doc is a list strings. If in my c# function I get a list values
as
| (string[] psValueList), how would I create an XML document from that. I
am
| assuming that the XML doc will be treated as a table of values in the
stored
| procedure.
|
| Am I even asking the right question ro am I way off track?
|
| Jim
|
|
|
 
Back
Top