RMatthe

Here is my problem. I have a number of fields on a SQL Server table that I need to store on another SQL Server table as an XML document. I have little or no experience with XML so I am hoping for some guidance.

Example:

Field1 = "Test"

Field2 = "Case"

Field3 = 100

On SQL Server

XMLString as Text

I need to create a string with a Parent and Elements for each field and write it to the XMLString field on the table.

I hope this is clear enough.

Thanks in advance.



Re: Visual Basic General Writing XML string to SQL Server

rkimble

Do you require a specific XML schema If not, it would be simplest to fill a DataTable with the values and then call WriteXML() on the DataTable to get an XML version of the data. This value can the be stored as Text in your other SQL table. You will be using the default schema generated by .NET if you do it this way. IF that won't work you'll probalby want to use an XmlTextWriter to output the table contents.




Re: Visual Basic General Writing XML string to SQL Server

RMatthe

Reed,

Thanks for your reply. I have not tried it yet as I am troubleshooting other issues but I will look into it. Do you know of any MSDN or other links that might have an example I could look at

Thanks Again.





Re: Visual Basic General Writing XML string to SQL Server

rkimble

Not specificaly, but if you search the MSDN Library for "DataTable.WriteXml" and "XmlTextWriter" you should be able to find code examples of each. I could also provide you with example code if needed. Check the library first and then post back here if you get stuck.

Good luck!