Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi ,

I Have done the Sql DataBase BackUP & Restore Project, in that BackupFile(Data's) Should Save as an Xml(File) can any Guide me soon ......


Thanks!!
Posted
Updated 13-Sep-11 7:13am
v3

If you are using ADO you can just put each table into a DataSet and use the WriteXml() function for the DataSet.
 
Share this answer
 
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connetionString As String
Dim connection As SqlConnection
Dim adapter As SqlDataAdapter
Dim ds As New DataSet
Dim sql As String

connetionString = "Data Source=" & Trim(txtServerName.Text) & ";Initial Catalog=" & Trim(txtDatabaseName.Text) & ";User ID=" & Trim(txtUsername.Text) & ";Password=" & Trim(txtPassword.Text)
connection = New SqlConnection(connetionString)

sql = " select * from Bank"

Try
sql = " select * from Bank"
connection.Open()
adapter = New SqlDataAdapter(sql, connection)
adapter.Fill(ds)
connection.Close()
ds.WriteXml("Bank".xml")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
'This is where we are saving the data in an XML file NewXMLName.xml
End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900