如何将数据从datagrid导出到xml文件? [英] how to export data from a datagrid to a xml file ?

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

问题描述

场景是这样的:-
(1)我有一个数据网格,其中填充了数据库中的值
(2)我的asp.net页面上有一个按钮
(3)当我单击我的按钮时,它应该将数据从datagrid导出到xml文件....!

我已经完成了前2部分,现在如何在单击按钮时将datagrid的值导出到xml文件?

有人可以帮我吗?

谢谢与问候
Akiii

Scenario is this :-
(1)i have a datagrid filled with values from a database
(2)i have a button in my asp.net page
(3)when i click my button it should export the datas from the datagrid to a xml file....!

i have done the the first 2 part, now how will i export the values of the datagrid to a xml file when the button is clicked ?

Can anybody help me regarding this?

Thanks and Regards
Akiii

推荐答案

请检查以下内容:

http://www.devx.com/tips/Tip/28651 [
Please check the following:

http://www.devx.com/tips/Tip/28651[^]


填充数据集.
As you fill your dataset.
DataSet ds=new DataSet();
SqlDataAdapter da = new SqlDataAdapter("select * from TabName");
da.Fill(ds);


现在您可以使用带有两个参数的WriteXml


Now you can use WriteXml which take 2 parameters

ds.WriteXml(string filename, mlWriteMode mode);


感谢答复.

我将数据存储在datagrid中,如何从datagrid查询数据并将其加载到SqlDataAdapter对象中?
Akiii
thanks for the reply.

i have the data in datagrid, how will a query data from a datagrid and load it into SqlDataAdapter object ??

Akiii


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

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