在wcf中返回数据表 [英] return datatable in wcf

查看:79
本文介绍了在wcf中返回数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友
我有一个返回数据表类型的方法,当从客户端调用此方法时给我一个错误:尝试反序列化参数http://tempuri.org/:GetTableDoctorResult时发生错误"
请帮助我,并给我您的想法...

hi freinds
i have a method that return datatable type , when call this method from client give me a error : "there was an error while trying to deserialize parameter http://tempuri.org/:GetTableDoctorResult"
please help me and give me your idea ...

推荐答案

这是一个老问题,但是很高兴看到它被封闭,因此我很高兴"尽我所能给你.

问题可能出在您的数据上.我相信通过DataTable中的WCF传递DBNull时会出现问题.如果将该值转换为真正的null,它将起作用.

另一个奇怪的解决方案似乎是要确保您的DataTable被命名.如果没有名称,则WCF序列化器会阻塞.

这两个想法似乎可以解决通过WCF传递DataTables的大多数问题.让我知道它是否有效.
This is an old question, but it would be nice to see it closed out as answered so I''ll give you what I can.

Probably the issue lies in your data. I believe there is an issue when you pass DBNull through WCF in a DataTable. If you convert that value to a true null, it will work.

The other weird solution out there seems to be to make sure your DataTable is named. If it does not hav a name, the WCF serializer chokes.

Those two ideas seem to solve most issues with passing DataTables through WCF. Let me know if it works.


这篇关于在wcf中返回数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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