ADO程序无法异步运行 [英] ADO program not able to run Asynchronously

查看:76
本文介绍了ADO程序无法异步运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用C ++编写的实时应用程序(VS 2008),它不能等待完成执行通过ADO同步执行的存储过程。所以我一直在尝试修改我的应用程序以使用ADO的异步调用,以便我可以
准备下一条信息并在它准备好后立即发送。我希望这样,所以我不需要缓冲或导致任何延迟,因为代码足够快,可以在上一次发送完成之前再次发送到数据库。

I have an Real-Time application written in C++ (VS 2008) that must not wait around to finish the execution of a Stored Procedure executing Synchronously via ADO. So i have been trying to modify my application to use ADO's Asynchronous calls so that i can prepare the next piece of information and send that as soon as it is ready. I want this so i do not need to buffer or cause any delays, as the code is fast enough to send to the Database again before the previous send has completed.

然而,每当我尝试使用adAsyncExecute我 不要获取raw_ExecuteComplete事件。我只是在关闭连接时看到这个,我认为这是错误的,如果没有adAsyncExecute选项,ity就不一样了。

However, whenever i try to use the adAsyncExecute i  do not get the raw_ExecuteComplete event. I only see this when i close the connection, which what i think is wrong as ity is not the same without the adAsyncExecute option.

此外,当我运行程序时,我收到以下错误之一:

Also when i run the program i get one of the following errors:


  • 操作不能是异步连接时执行。
  • 连接不能用于执行此操作。在此上下文中它已关闭或无效。

我在Web上搜索并通过ADO指南(我只在MDAC 2.8 SDK中找到),但是找到相关信息,但绝对没有答案让它工作异常。

I have search around on the Web and through ADO Guide (which i found only in the MDAC 2.8 SDK), but have found related information but absolutely no answers to make it work Asynchonously.

所以任何人都可以为我成功地与ADO异步工作做好准备。

So can anyone please shed any light at all for me to successfully work with ADO Asynchronously.

非常感谢!

Rich。

Rich.

推荐答案


我有一个用C ++(VS 2008)编写的实时应用程序,它不能等待完成执行同步执行的存储过程通过ADO。所以我一直在尝试修改我的应用程序以使用ADO的异步调用,以便我可以
准备下一条信息并在它准备好后立即发送。我希望这样,所以我不需要缓冲或导致任何延迟,因为代码足够快,可以在上一次发送完成之前再次发送到数据库。

I have an Real-Time application written in C++ (VS 2008) that must not wait around to finish the execution of a Stored Procedure executing Synchronously via ADO. So i have been trying to modify my application to use ADO's Asynchronous calls so that i can prepare the next piece of information and send that as soon as it is ready. I want this so i do not need to buffer or cause any delays, as the code is fast enough to send to the Database again before the previous send has completed.

然而,每当我尝试使用adAsyncExecute我 不要获取raw_ExecuteComplete事件。我只是在关闭连接时看到这个,我认为这是错误的,如果没有adAsyncExecute选项,ity就不一样了。

However, whenever i try to use the adAsyncExecute i  do not get the raw_ExecuteComplete event. I only see this when i close the connection, which what i think is wrong as ity is not the same without the adAsyncExecute option.

此外,当我运行程序时,我收到以下错误之一:

Also when i run the program i get one of the following errors:


  • 操作不能是异步连接时执行。
  • 连接不能用于执行此操作。在此上下文中它已关闭或无效。

我在Web上搜索并通过ADO指南(我只在MDAC 2.8 SDK中找到),但是找到相关信息,但绝对没有答案让它工作异常。

I have search around on the Web and through ADO Guide (which i found only in the MDAC 2.8 SDK), but have found related information but absolutely no answers to make it work Asynchonously.

所以任何人都可以为我成功地与ADO异步工作做好准备。

So can anyone please shed any light at all for me to successfully work with ADO Asynchronously.

非常感谢!

Rich。

Rich.

你应该看看"Open Method(ADO Recordset)":

You should look at "Open Method (ADO Recordset)":

http://msdn.microsoft.com/en-us/library/windows/desktop/ms675544(v = vs.85)的.aspx 功能 

如果已将CursorLocation属性设置为adUseClient,则可以通过两种方式之一异步检索行。建议的方法是将
选项设置为 adAsyncFetch 。或者,您可以使用"异步行集处理"和"异步行集处理"。 Properties集合中的动态属性,但如果未将Options参数设置为adAsyncFetch,则相关的检索事件可能会丢失。

If you have set the CursorLocation property to adUseClient, you can retrieve rows asynchronously in one of two ways. The recommended method is to set Optionsto adAsyncFetch. Alternatively, you can use the "Asynchronous Rowset Processing" dynamic property in the Properties collection, but related retrieved events can be lost if you do not set the Options parameter to adAsyncFetch.

另请参阅  http://support.microsoft.com/kb/268797/e

See also http://support.microsoft.com/kb/268797/e




这篇关于ADO程序无法异步运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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