Does the Microsoft SQL Server native client support IDBAsynchNotify?

Posted by Aaron Klotz on Stack Overflow See other posts from Stack Overflow or by Aaron Klotz
Published on 2010-01-13T01:50:41Z Indexed on 2010/05/30 7:12 UTC
Read the original article Hit count: 431

Filed under:
|
|

I'm working on some OLE DB code that runs queries on MS SQL Server via ICommand::Execute. I'm converting this code to operate asynchronously by setting the DBPROPVAL_ASYNCH_INITIALIZE property on the command before executing.

I'd prefer to register a IDBAsynchNotify sink so that my code can be notified of events, as opposed to polling or blocking via ISSAsynchStatus.

The documentation for ICommand::Execute does not show IConnectionPointContainer as an acceptable riid parameter, but the same document, when discussing the DB_S_ASYNCHRONOUS return code, suggests that it is possible to request an IConnectionPointContainer interface that I could use to register my event sink.

When I call ICommand::Execute, passing IID_IConnectionPointContainer as the riid parameter, I receive the E_NOINTERFACE error. I also tried setting the DBPROP_IConnectionPointContainer property before Execute but I received the same results.

If I have to, I'll use ISSAsynchStatus, but I'd much rather use IDBAsynchNotify. Is it possible?

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about oledb