Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have Xml file in Soap Format ,how to read xml file in frontend And send to database.
(i get xml file via Biz talk sever)
Posted
Comments
Sandeep Mewara 23-Jan-11 3:37am    
Care to elaborate? XML is very easy way to communicate and use. What issue you are facing in order to use it? Did you try anything?

1 solution

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: )

MSIL
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
 
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