Create XML File from a Dataset : ASP.NET

Import System.Data
Import System.Data.SQLClient
Import System.Xml
Import System.Xml.Xsl

dim strXML as String = "myXml.xml"
dim ConnectionString as string = "ur connection string"

Dim conn As SqlConnection = New SqlConnection(ConnectionString)
Dim ds as DataSet = new DataSet()
dim strSql as string = "SELECT * FROM MYTABLE"
dim objAdp as strSqlDataAdapter = new strSqlDataAdapter(strSql, conn)

objAdp.Fill(ds,"WhatsNew")
conn.Close()
ds.WriteXml(strXML, XmlWriteMode.IgnoreSchema)

No comments:

Post a Comment