以xml格式从数据集获取数据的方法 [英] Way get the data from Dataset in xml Format

查看:88
本文介绍了以xml格式从数据集获取数据的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我需要以xml格式显示数据集的结果,我正在尝试使用流和getxml之类的方法并编写xml,但我没有运气,有没有办法我可以得到结果XML格式,请帮助我,代码如下所示



HI i have a requirement where i need to show the result from dataset in xml format i am trying to use some methods like stream and getxml and write xml but i dont have luck , is there a way i can get the result in XML Format ,Please help me, the code looks like this



protected void btn_click(object sender, EventArgs e)
    {
        ServicesCharles.Service ss = new ServicesCharles.Service();
        DataSet dsDetails = ss.getbrokerdetails(a.Text, b.Text);
                ltl.Text = dsDetails.GetXml();
}



当我运行此程序时,我没有得到xml格式的输出



when i run this i am not getting the output in xml format

推荐答案

也许没有结果.

DataSet.GetXml返回一个字符串,该字符串表示存储在DataSet中的数据.

这是我使用的东西:

Perhaps there are no results.

DataSet.GetXml returns a string that is a representation of the data stored in the DataSet.

This is something I use:

MemoryStream s = new MemoryStream();
dsDetails.WriteXml(s);

byte[] Bytes = new byte[Convert.ToInt32(s.Length - 1) + 1];
//Go to first position in stream
s.Position = 0;
//Copy stream to buffer
s.Read(Bytes, 0, Bytes.Length);
string XML = ASCII.GetString(Bytes);



DataSet.WriteXml:从数据集写入XML数据,并可选地写入架构.



DataSet.WriteXml: writes XML data, and optionally the schema, from the DataSet.



这篇关于以xml格式从数据集获取数据的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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