This is a cool idea to save a DataSet as XML file with VB.net, So far you can convert an SQL DataBase to XML format.
The code :
Private Sub btnWriteXMLData_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnWriteXMLData.Click
Dim dsSales As New DataSet()
Dim cn As New SqlConnection _
("data source=localhost;initial catalog=pubs;user id=sa")
Dim daAuthors As New SqlDataAdapter("select * from sales ", cn)
Dim daPublishers As New SqlDataAdapter("select * from stores ", cn)
' Load data from database
daAuthors.Fill(dsSales, "Sales")
daPublishers.Fill(dsSales, "Stores")
' Write XML to file
dsSales.WriteXml("XMLFile.xml")
End Sub
Hope it helps and good luck, any suggestion or questions post a comment !
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment