当表非空时从 SQL Server 接收自动通知
我想使用 SQL Server 表作为操作队列。 因此,只要表格非空,我就希望向我的 VDF 应用程序发出某种通知,在以避免不断轮询数据库。 VDF 依赖于使用 stdcall,这是 Win 32 API 或 COM 的标准调用约定/ActiveX。 另一个对我有用的解决方案是在表非空时简单地运行 exe 文件。
SQL Server 中有没有可以在这里使用的事件? 您将如何引导此类事件供 VDF 使用(如上所述)?
I would like to use an SQL Server table as an action queue. So whenever the table is non-empty, I'd like some sort of notification to my VDF application, in order to avoid constantly polling the database. VDF relies on using stdcall, the standard calling convention for the Win 32 API, or COM/ActiveX. Another solution that could work for me is to simply run an exe file when the table is non-empty.
Are there any events in SQL Server that could be used here? And how would you go about channeling such an event to be used by VDF (as described above)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 ON INSERT 触发器,可能将行直接发送到 MSMQ,您的应用程序在新消息进入时侦听事件。
这是一个 如何使用 SQL Server 提供 MSMQ 的示例,此处关于如何监听事件的简短说明。
还有 SQL Server 事件提供程序,这基本上只是为你进行轮询。
You could use an ON INSERT trigger, possibly to send the row right to MSMQ, where your application listens for events as new messages come in.
Here is an example of how to feed MSMQ using SQL Server, and here a short one on how to listen for events.
There also is the SQL Server Event Provider, which basically just does the polling for you.
您将如何引导此类事件供 VDF 使用。您如何
引导至 VDF 取决于您是否希望在 VDF 应用程序内发生可见的事件,或者您是否只想触发一个过程在VDF中。
如果是后者,我建议您使用 Webapp 来提供此功能。 VDF(版本超过 10 左右)内置了 Web 开发,并且可以轻松提供 SOAP 接口来完成您想要的任何操作。
如果是前者,那么不必担心使用计时器对象每隔几秒左右轮询一次数据库。 您会发现代码更加“dataflex”,并且对性能的影响可以忽略不计。
不过,有一个适用于 MSMQ 的开源 VDF 库,可以在 ..
http://www.vdf-guidance.com/ContribPage。 asp?Page=PKGGENMESSAGING&ContribRecId=106
最后 - 数据访问新闻组是获得 Visual Dataflex 支持的最佳场所。 使用 http://sture.dk/wasp 搜索历史新组并转到 news.dataaccess.com(使用您选择的 NNTP 客户端)来发布和回答问题。
How would you go about channeling such an event to be used by VDF.
How you'd channel to VDF depends on whether you want something visible happening inside your VDF application or whethor you just want to trigger a procedure in VDF.
If the latter, I'd suggest you use a Webapp to provide this functionality. VDF (versions over about 10) have web development built in, and it's simple to provide a SOAP interface to do whatever you want.
If the former, then don't be worried about using a timer object to poll the database every couple of seconds or so. You'll find the code is more "dataflex" and there's only a negligible perfomance hit.
There is however an open source VDF library for MSMQ, and that can be found at ..
http://www.vdf-guidance.com/ContribPage.asp?Page=PKGGENMESSAGING&ContribRecId=106
Finally - The Data Access newsgroups are the best place to go for Visual Dataflex support. Use http://sture.dk/wasp to search historical newgroups and go to news.dataaccess.com (using an NNTP client of your choice) to post and answer questions.