Groups | Blog | Home
all groups > sql server odbc > december 2003 >

sql server odbc : Non blocking query on a table in SQL Server 2000



Vishal Prabhu
12/19/2003 11:31:41 AM
Hi Folks,

How can I invoke a non blocking ODBC query on a table in a SQL Server
database. Our current design requires the method invoking the query to
'return' immediately after invoking the query. The results of the query
should be put in a globally accessible location.

I think SQLFetch is a blocking call.

Thanks,
Vishal

*** Sent via Developersdex http://www.developersdex.com ***
Elvis Presley
12/28/2003 8:08:38 AM
Vishal,

You have to use muliple threads. It is SQL Execute that usually takes
long time, not SQLFetch(). A call to single SQLFetch usually does not
take long unless you have some network connection problem.

Here is what you can do:

From your main application thread spawn a new one that does
SQLExecute(). The same spawned thread will call SQLFetch and put the
result in a shared buffer, possibly a global to you app. Then send a
Window message to you application notifying it that some data has be put
in the buffer. Read this data from your primary thread.

Regards,

Elvis
Dead not so long ago.




[quoted text, click to view]
AddThis Social Bookmark Button