Heavy sql without helding application
Hi All,
Once again i am in a problem. Is there any method to execute heavy sql queries without helding the application. I explain:
Frontend = VB6
Backend = MS SQL Server2000
I have lot of sql queries (of insert and update) in my vb application, which takes 3 to 4 hours to complete on the query analyzer. If I execute same queries from my vb aplication, the application held untill the query complete. I know that the execute command from VB waits for the response of executed command. But do You know any solution that the user of application can use application while he also execute any sql for a long time.
Logically I am thinking that it can be done if I added all my execution plan in my different vb exe files, and execute the concern exe (through shell command), so the concern exe will execute the sql and my main application will be smoothly on the way. is it posible or do you have better idea. and also if it is possible, then how can i send parameters from my main application to concern exe to execute the sql.
Thanks in advance for the solution.
Umar
Re: Heavy sql without helding application
Look at posts relating to multi-threading. You want to execute the SQL processing in a background thread.
Re: Heavy sql without helding application
You can use diffrent process to run the queries in background.
Use command line arguments with your .exe to send all related information such as login to database, sp name and so on.
Re: Heavy sql without helding application
Dear Mr Shiekh,
kindly explain, if any example. plz.
Re: Heavy sql without helding application
The better way of doing this would be to use Asynchronous processing feature of ADO. Take a look at this KB article on MSDN.
http://support.microsoft.com/kb/190988
Just to elaborate on my point, acheiving Mutlithreading is not a simple task. It requires lot of effort and may become un-manageable over the period of time. VB 6 does not have an internal support for MultiThreading. You need to have a work around for multithreading and a search here would give you few examples of how to do it.
But I would still use the adAsyncExecute feature of the ADO.
You could also search here for adAsyncExecute and you will get enough samples to make you understand how exactly to use it.