如何在 asmx Web 服务中返回多个数据库行
我可以在网络服务中返回单个值,但我不知道如何返回多行。我有一个来自数据库的 ILIST 数据集合。
I can return a single value in my webservice, but I can't figure out how to return multiple rows. I have an ILIST collection of the data from my database.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您的 Web 服务的方法返回对象数组,那就可以了。
因此,基本上您只需将该 IList 转换为数组,然后根据 IList 中的对象类型,用要返回的数据填充一些标准对象。
If the method of your web service returns arrays of objects, that should do the trick.
So basically you just have to convert that IList to an array and, depending on what type of objects you have in the IList, fill some standard objects with the data to be returned.
创建一个可以保存所有行的类,然后返回该类
Create a class that can hold all the rows, then return that class
假设您希望将多个数据传递到 Web 服务并在表中获取结果记录。
这个例子将帮助你理解。
Assuming u want multiple data to pass to web service and get resultant records in ur table.
this example will help u to understand.