如何从gridview数据中编写xml文件 [英] How to write xml file from gridview data

查看:121
本文介绍了如何从gridview数据中编写xml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,请你帮帮忙。我正在尝试从GridView中的数据创建一个xml,下面是我用于填充GridView的代码

Hi Guys can you please help. I am trying to create an xml from the data in the GridView, below is the code that I have for populating the GridView

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

       Dim dt As New DataTable()
       Dim strConnString As String = System.Configuration.ConfigurationManager.ConnectionStrings("ApplicationServices").ConnectionString
       Dim strQuery As String = "select * from Customer_Details"
       Dim cmd As New SqlCommand(strQuery)
       Dim con As New SqlConnection(strConnString)
       Dim sda As New SqlDataAdapter()
       cmd.CommandType = CommandType.Text
       cmd.Connection = con
       Try
           con.Open()
           sda.SelectCommand = cmd
           sda.Fill(dt)
           Me.GridView1.DataSource = dt
           Me.GridView1.DataBind()
       Catch ex As Exception
           Response.Write(ex.Message)
       Finally
           con.Close()
           sda.Dispose()
           con.Dispose()
           dt.Dispose()
       End Try

   End Sub

推荐答案

检查这个链接



35215-aspnet -c%23-export-gridview-to-xml / [ ^ ]





希望它会有所帮助
Check this links

35215-aspnet-c%23-export-gridview-to-xml/[^]


Hope it will help


这篇关于如何从gridview数据中编写xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆