Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. SQL to XML & XML to SQL

SQL to XML & XML to SQL

Scheduled Pinned Locked Moved ASP.NET
databasexml
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kirthikirthi
    wrote on last edited by
    #1

    Hi all I am trying SQL to XML means i want to store SQL table records in XML And Again XML to SQL Can any one give me an idea Than Q

    asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf

    F 1 Reply Last reply
    0
    • K kirthikirthi

      Hi all I am trying SQL to XML means i want to store SQL table records in XML And Again XML to SQL Can any one give me an idea Than Q

      asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf

      F Offline
      F Offline
      Felipe Dalorzo
      wrote on last edited by
      #2

      What database server are you using? Is it SQL Server

      K 1 Reply Last reply
      0
      • F Felipe Dalorzo

        What database server are you using? Is it SQL Server

        K Offline
        K Offline
        kirthikirthi
        wrote on last edited by
        #3

        Hi THX for reply Yes it is SQL server

        asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf

        F 1 Reply Last reply
        0
        • K kirthikirthi

          Hi THX for reply Yes it is SQL server

          asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf

          F Offline
          F Offline
          Felipe Dalorzo
          wrote on last edited by
          #4

          Now, can you provide an example of what is it that you want?

          K 1 Reply Last reply
          0
          • F Felipe Dalorzo

            Now, can you provide an example of what is it that you want?

            K Offline
            K Offline
            kirthikirthi
            wrote on last edited by
            #5

            In sql server i have an table called "WW" That table records i want to copy to XML file (WW.xml) I done the SQL to XML like this Dim dsn, sqlEmp As String dsn = "Provider=SQLOLEDB;server=;uid=;pwd=;database=Test" sqlEmp = "select * from WW" Dim connection As New OleDbConnection(dsn) Dim command As New OleDbDataAdapter(sqlEmp, connection) Dim dsCustomers As New DataSet command.Fill(dsCustomers, sqlEmp) dsCustomers.WriteXml(Server.MapPath("WW.xml")) It will transfer all the records to XML file Now i want to this XML file to transfer to SQL server New Table How can i do this

            asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf

            M 1 Reply Last reply
            0
            • K kirthikirthi

              In sql server i have an table called "WW" That table records i want to copy to XML file (WW.xml) I done the SQL to XML like this Dim dsn, sqlEmp As String dsn = "Provider=SQLOLEDB;server=;uid=;pwd=;database=Test" sqlEmp = "select * from WW" Dim connection As New OleDbConnection(dsn) Dim command As New OleDbDataAdapter(sqlEmp, connection) Dim dsCustomers As New DataSet command.Fill(dsCustomers, sqlEmp) dsCustomers.WriteXml(Server.MapPath("WW.xml")) It will transfer all the records to XML file Now i want to this XML file to transfer to SQL server New Table How can i do this

              asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf

              M Offline
              M Offline
              Member_3269611
              wrote on last edited by
              #6

              Hi Friend, I Envisage the has two Columns. Private Con As SqlConnection Private Com As SqlCommand Private DSET As DataSet Con = New SqlConnection("Your Connection String") Com = New SqlCommand("Insert Values(@ID,@Name )", Con) '/*** If the TWO column are String Type ***/ Com.Parameters.Add("@ID", SqlDbType.VarChar, 5) Com.Parameters.Add("@Name", SqlDbType.VarChar, 50) DSET = New DataSet() DSET.ReadXml("WW.xml") Dim R As Int32 Con.Open() For R = 0 To DSET.Tables(0).Rows.Count - 1 Com.Parameters("@ID").Value =DSET.Tables(0).Rows(R)(0) Com.Parameters("@Name").Value =DSET.Tables(0).Rows(R)(1) Com.ExecuteNonQuery() Next Con.Close() With Regards, Pandian S

              K 1 Reply Last reply
              0
              • M Member_3269611

                Hi Friend, I Envisage the has two Columns. Private Con As SqlConnection Private Com As SqlCommand Private DSET As DataSet Con = New SqlConnection("Your Connection String") Com = New SqlCommand("Insert Values(@ID,@Name )", Con) '/*** If the TWO column are String Type ***/ Com.Parameters.Add("@ID", SqlDbType.VarChar, 5) Com.Parameters.Add("@Name", SqlDbType.VarChar, 50) DSET = New DataSet() DSET.ReadXml("WW.xml") Dim R As Int32 Con.Open() For R = 0 To DSET.Tables(0).Rows.Count - 1 Com.Parameters("@ID").Value =DSET.Tables(0).Rows(R)(0) Com.Parameters("@Name").Value =DSET.Tables(0).Rows(R)(1) Com.ExecuteNonQuery() Next Con.Close() With Regards, Pandian S

                K Offline
                K Offline
                kirthikirthi
                wrote on last edited by
                #7

                Hi THX for reply Plz can u chk u this what wrong here It is giving this ERROR ------ Declare "@code" Dim Con As OleDbConnection Dim Com As OleDbCommand Dim DSET As DataSet Con = New OleDbConnection("Connection String") Com = New OleDbCommand("Insert into ww Values(@Code,@Month))", Con) Com.Parameters.Add("@Code", OleDbType.VarChar, 200, "@Code") Com.Parameters.Add("@Month", OleDbType.VarChar, 200, "@Month") DSET = New DataSet DSET.ReadXml(Server.MapPath("WW.xml")) Dim R As Int32 Con.Open() For R = 0 To DSET.Tables(0).Rows.Count - 1 (ERROR) Com.Parameters("@Code").Value = DSET.Tables(0).Rows(R)(0) Com.Parameters("@Month").Value = DSET.Tables(0).Rows(R)(1) Com.ExecuteNonQuery() Next Con.Close() -- modified at 2:00 Wednesday 16th August, 2006

                asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups