Web服务中的数据表 [英] DataTable in Web Service
本文介绍了Web服务中的数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想知道是否可以将Web Service中的DataTable用作na输出.我该怎么做?
I just want to know if it is possible to use DataTable in Web Service as na output. how can I do this?
推荐答案
尝试这个
而是返回一个数据集.您需要适当的XML
谢谢
hemant
try this
return a dataset instead. you need proper XML
Thanks
hemant
DataTables是XML可序列化的,因此您可以将它们用作XML Web Service的输入和输出.这是MSDN上的文章使用XML Web服务中的数据集 [ ^ ]
希望对您有帮助
DataTables are XML serializable, and so you can use them as both input and output from an XML Web Service. Here is an article from MSDN Consuming a DataSet from an XML Web Service[^]
Hope this helps
您可以在WebService中返回DataTable.
您只需要提供完整的DataTable名称即可.
例如
DataTable dt =新的DataTable("YourTableName");
就这样.
要在Web服务中返回对象,Microsoft需要对对象进行序列化.
那时,您的数据表对象必须具有名称.因此,微软将像
那样转换为XML. < yourtablename>
< ------
----->
< yourtablename>
如果您的表没有名称,Microsoft将无法序列化为XML文件.因此,将引发错误.
谢谢
You can return DataTable in WebService.
You just need to give full DataTable name.
e.g
DataTable dt = new DataTable("YourTableName");
That''s all.
To return object in web service, Microsoft need to serialize the object.
At that time your data table object must has name. So, Microsoft will convert to XML like
<yourtablename>
<------
----->
<yourtablename>
If your table has no name, Microsoft cannot serialize as XML file. So, will be throw error.
Thanks
这篇关于Web服务中的数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文