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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to generate XML file from table with name element

Status
Not open for further replies.

aa1232

Programmer
Oct 25, 2006
2
GB
Hi Folks,

I am trying to generate an XML file with element as name in it. file is sucessfully generates from database table as shown in code below, but i dont understand how to add name element same as node name.

Dim tstNmSql As String = "SELECT PRODUCT_NAME, TEST_NAME FROM REL_TEST_NAMES"
Dim tstNmAdapter As SqlDataAdapter = New SqlDataAdapter(tstNmSql, myConnection)
tstNmAdapter.Fill(ds, "XML_TEST_NAME")
ds.WriteXml(xml_tstNmList, XmlWriteMode.IgnoreSchema)
tstNmAdapter.Dispose()
ds.Clear()

this code generates xml file like code below. but, i want to do <PRODUCT_NAME name='PRODUCT_NAME'>ALx</PRODUCT_NAME>


<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<XML_TEST_NAME>
<PRODUCT_NAME>ALx</PRODUCT_NAME>
<TEST_NAME>NBQ SEx</TEST_NAME>
</XML_TEST_NAME>
<XML_TEST_NAME>
<PRODUCT_NAME>ALxxA</PRODUCT_NAME>
<TEST_NAME>NBQ SExxxA</TEST_NAME>
</XML_TEST_NAME>
</NewDataSet>



any help would be really appreciated. hope to hear for XML guys some hint or link to relative solution.

Regards

Jagjot

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top