如何在Delphi中使用.NET数据集?

发布于 2024-12-22 22:56:23 字数 259 浏览 2 评论 0原文

我想使用一个接受 SQL 语句的 .NET Web 服务,例如:select * from my_table order by name 并将该数据集返回到我的 Delphi ClientDataSet /断开TADODataSet,并将在 TDBGrid 中显示结果。

第 2 部分)更新单个记录后,我希望能够通过 Web 服务更新 .NET 数据集。

我怎样才能做到这一点? (请输入代码)

I want to consume a .NET web-service that will accept SQL statement, for example: select * from my_table order by name and will return that dataset to my Delphi ClientDataSet / disconnected TADODataSet, and will display the result in the TDBGrid.

Part 2) After I update a single record I want to be able to update the .NET dataset via a webservice.

How can I do that? (Code Please)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

︶ ̄淡然 2024-12-29 22:56:23

1) .Net 数据集使用 XML 来传输数据,因此您可以将它们作为 XML 读取,然后将它们转换为 Delphi 数据集,请查看这些文章

在 Delphi 中使用 ADO.NET 数据集

在 Delphi 中使用 .NET 数据

2) 据我了解,您将使用 Web 服务,因此最好向您的服务添加更新方法并调用它来更新数据。

需要注意的是,IMO,按照您想要使用的方式将原始 SQL 发送到 Web 服务是一种糟糕的设计,我更希望您将业务逻辑定义为一组方法,然后根据应用程序需求调用它们。

您还可以使用 Delphi Prism 更轻松、更好地进行 .Net 集成

1) .Net datasets uses XML to transfer it's data, so you can read them as XML then convert them to Delphi Dataset, Look at these articles

Use ADO.NET Datasets in Delphi

Working with .NET data in Delphi

2) As I understand you will using Web services, so it will be better to add an update method to your service and call it to update the data.

One note, IMO, sending raw SQL to web services as the way you would like to use is a bad design, I prefer you to do define your business logic as group of methods, then call them as your application needs.

Also you can use Delphi Prism for more easier and better .Net integration

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文