The information in this article applies to:
SUMMARYThis article provides the basic information necessary to execute a query asynchronously in a SQL Server front-end using the Microsoft Visual Basic Library for SQL Server (VBSQL). MORE INFORMATION
Queries sent from a Visual Basic front-end to SQL Server can be sent either
synchronously or asynchronously. Synchronous query execution is done by
calling SqlExec% to execute the query. The client program will pause
execution on the SqlExec% line until the query has been completely
processed by the server, and the results returned to the client program.
The SqlDataReady% function will return SUCCEED as soon as there is data available for processing. Under certain circumstances, some data may be available for processing at the client, but SqlOk% will still take some time to return. This is because SqlOk% verifies correctness of the entire command batch and can only return SUCCEED when an entire result set is available for processing with SqlResults%. Therefore, it is possible to get into a situation where the SQL Server begins to send data packets back to the client which causes SqlDataReady% to correctly return SUCCEED but more processing must be done at the server, and more data must be sent back to the client before SqlOk% can complete its work and return SUCCEED. If the above situation occurs, any queries or stored procedures involved would need to be restructured and sent in pieces to avoid a long delay on the call to SqlOk%. NOTE: The same technique for asynchronous query execution could be used in a Windows application using DB-Library (DB-Lib) for C. The VBSQL function calls would need to be changed to their DB-Library for C equivalents. Also, the call to DoEvents() would need to be replaced with appropriate Windows message-handling code. For more information on DB-Library programming techniques, see the article "Developing Microsoft Windows-Based Applications for Microsoft SQL Server" in the SQL Server Resource Kit, which is available on the Microsoft Technet CD. Additional query words: VB
Keywords : kbinterop SSrvVisB |
Last Reviewed: March 20, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |