如何将数据保存在xml文件形式的数据库中? [英] How to save data in a xml file form database?

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

问题描述


我想将数据库中的数据保存到xml文件中.我正在使用asp.net和C#.
xml文件将保存在客户端PC中.我想这样做以便更快地计算.
我将数据保存在xml文件中.然后将基于该xml文件执行计算.
否则任何人都可以给我更好的解决方案.
有什么可以帮助我的吗?

Hi,
I want to save data from my database into xml file. I am using asp.net and C#.
The xml file will be save in client pc. I want to do this for faster calculation.
I will save data in xml file. Then calculation will be performed based on that xml file.
Or anyone can give me better solution.
Is there any one to help me?

推荐答案

有几种方法可以做到这一点
1.使用ExecuteXmlReader()方法运行返回XML的SELECT语句.

2.
There are several ways to do that
1. Use the ExecuteXmlReader() method to run a SELECT statement that returns XML.

2.
// Populate DataSet using Database
   SqlDataAdapter objSQLADP = new SqlDataAdapter("select * from tableName", "your_conn_str");
    DataSet ds=new DataSet;
    objSQLADP.Fill(ds,"tableName");
    ds.WriteXml("file.xml");  // Write Data into XML


这篇关于如何将数据保存在xml文件形式的数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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