Export DataGrid data to an XML File

Monday, 30 June 2008 10:45 by scngan

Export DataGrid data to an XML File.

 

To export data from datagrid to XML, you can use WriteXML function.

Example :

        Dim myCommand As SqlDataAdapter
        myCommand = New SqlDataAdapter("Select * from student", myconn)
        ' declare the dataset function
        Dim ds As DataSet = New DataSet()
        myCommand.Fill(ds, "student")
        DataGridView1.DataSource = (ds)
        DataGridView1.DataSource = ds.Tables(0)


        ds.WriteXml("c:\student.xml")

Download : exportXML.wmv (680.55 kb)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:  
Categories:   Technical Stuff
Actions:   | E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed
Comments are closed