CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2006
    Posts
    65

    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

  2. #2
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Heavy sql without helding application

    Look at posts relating to multi-threading. You want to execute the SQL processing in a background thread.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  3. #3
    Join Date
    Dec 2006
    Location
    Pune, India.
    Posts
    579

    Thumbs up 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.

  4. #4
    Join Date
    Oct 2006
    Posts
    65

    Re: Heavy sql without helding application

    Dear Mr Shiekh,

    kindly explain, if any example. plz.

  5. #5
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured