Hi.
I think you want to write a XML-Database to your (SQL-)Server back??
I am using this code to add a my (exported) xml file back to my database.
(It's vb.net ... you have to change the syntax a little bit for c# :laugh: )
Private Sub cmdXMLImport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdXMLImport.Click
Dim dialog As New OpenFileDialog
dialog.InitialDirectory = Application.StartupPath()
dialog.Filter = "XML (*.xml)|*.xml"
If dialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim sqlConnection As SqlClient.SqlConnection = New SqlClient.SqlConnection(SQL-CONNECTIONSTRING)
Dim sqlcmd As SqlCommand = New SqlCommand("Select * from yourTABLE", sqlConnection)
sqlConnection.Open()
Dim da As New SqlDataAdapter(sqlcmd)
Dim ds As New DataSet
da.Fill(ds)
Dim dsNew As New DataSet
dsNew.ReadXml(dialog.FileName, XmlReadMode.Auto)
Dim cb As New SqlClient.SqlCommandBuilder(da)
da.InsertCommand = cb.GetInsertCommand
Try
da.Update(dsNew.Tables(0))
Catch ex As Exception
MessageBox.Show(Convert.ToString(ex))
End Try
sqlConnection.Close()
End If
End Sub
Regards,
The.Z