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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Problem in binding grid with XML(From DB)

Problem in binding grid with XML(From DB)

Scheduled Pinned Locked Moved .NET (Core and Framework)
databasequestioncsharpcss
6 Posts 2 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.
  • N Offline
    N Offline
    nileshbahirshet
    wrote on last edited by
    #1

    Hi , I am new in .NET technology... I have a XML file containing following data... <?xml version="1.0" encoding="utf-8"> <MyData> <EmployeeName>aaa</EmployeeName> <age>25</age> </MyData> Now,I want to simply store this into databse(SQL server 2005)using VB.NET and I want to retrive same data and bind to grid... How can I do this ?

    N 1 Reply Last reply
    0
    • N nileshbahirshet

      Hi , I am new in .NET technology... I have a XML file containing following data... <?xml version="1.0" encoding="utf-8"> <MyData> <EmployeeName>aaa</EmployeeName> <age>25</age> </MyData> Now,I want to simply store this into databse(SQL server 2005)using VB.NET and I want to retrive same data and bind to grid... How can I do this ?

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Don't post the same question, even if th title is changed You have a number of options. You could store the document in a database table with the column of type text or xml and use an XmlDataSource object to bind it to your control. You could also store the content of the xml file as individual columns in a database table and bind your grid to a datatable.


      only two letters away from being an asset

      N 1 Reply Last reply
      0
      • N Not Active

        Don't post the same question, even if th title is changed You have a number of options. You could store the document in a database table with the column of type text or xml and use an XmlDataSource object to bind it to your control. You could also store the content of the xml file as individual columns in a database table and bind your grid to a datatable.


        only two letters away from being an asset

        N Offline
        N Offline
        nileshbahirshet
        wrote on last edited by
        #3

        Thanx buddy, but i have still some issue.. I have created the table call XMLTest into database in which I have two fields PKID-Integer datatype Data-XML datatype While storing the xml data into database whether I have to put the line at start of the data or not ?

        N 1 Reply Last reply
        0
        • N nileshbahirshet

          Thanx buddy, but i have still some issue.. I have created the table call XMLTest into database in which I have two fields PKID-Integer datatype Data-XML datatype While storing the xml data into database whether I have to put the line at start of the data or not ?

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          It doesn't matter. Have you at least tried it before asking?


          only two letters away from being an asset

          N 1 Reply Last reply
          0
          • N Not Active

            It doesn't matter. Have you at least tried it before asking?


            only two letters away from being an asset

            N Offline
            N Offline
            nileshbahirshet
            wrote on last edited by
            #5

            Hi... I have try it I have store the data into databse in following format... (orignal data in file) aaa 21 I store the following data using this code dim xmldata = aaa_ 21 SqlConnection.Open() Dim cmd As New SqlCommand("insert into xmlTest Values(62,'" & xmldata & "')", SqlConnection) cmd.ExecuteNonQuery() MessageBox.Show("Record Saved Succsessfully") SqlConnection.Close() it stores sucsessfully but after executing the following query I get the this data... Select * from xmlTest for xml auto I get this data after firing the query on that row of SQL server aaa 11 befor going to ask about retriving the data first tell me whether I am storing the data in right format or not ?

            N 1 Reply Last reply
            0
            • N nileshbahirshet

              Hi... I have try it I have store the data into databse in following format... (orignal data in file) aaa 21 I store the following data using this code dim xmldata = aaa_ 21 SqlConnection.Open() Dim cmd As New SqlCommand("insert into xmlTest Values(62,'" & xmldata & "')", SqlConnection) cmd.ExecuteNonQuery() MessageBox.Show("Record Saved Succsessfully") SqlConnection.Close() it stores sucsessfully but after executing the following query I get the this data... Select * from xmlTest for xml auto I get this data after firing the query on that row of SQL server aaa 11 befor going to ask about retriving the data first tell me whether I am storing the data in right format or not ?

              N Offline
              N Offline
              nileshbahirshet
              wrote on last edited by
              #6

              Hi... I have try it I have store the data into databse in following format... (orignal data in file) aaa 21 I store the following data using this code dim xmldata = _ aaa21 SqlConnection.Open() Dim cmd As New SqlCommand("insert into xmlTest Values(62,'" & xmldata & "')", SqlConnection) cmd.ExecuteNonQuery() MessageBox.Show("Record Saved Succsessfully") SqlConnection.Close() it stores sucsessfully but after executing the following query I get the this data... Select * from xmlTest for xml auto I get this data after firing the query on that row of SQL server <-------------------------------table name and PKID <-------------------------------Column Name of Table aaa 11 befor going to ask about retriving the data first tell me whether I am storing the data in right format or not ?

              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