Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Location
    USA
    Posts
    1

    Unanswered: Program Handles in VB

    Hi,
    We are programming a client server application using Visual Basic 6.0. In this program which is a multi step program, the first step is to run a bcp command and load the data into the database. The next steps are to work on this data for the business purposes.

    The problem we are facing is that we run the bcp command using the shell or shellexecute command from visual basic event. As soon as this is invoked, the program moves on to the next line of code. We would like the VB line of code to wait until the completion of BCP execution in the shell and then continue with the next piece of code.

    Could anyone give me ideas as to how this can be implemented.

    regards
    Subramanya

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: Program Handles in VB

    Yes create an ADO connection object with events to your SQL server. Run the bcp command through the connection object instead of using the Shell. Then wait for the ExecuteComplete event to continue with the rest of the code.

    i.e.

    Private WithEvents cnSCIROCCO As ADODB.Connection

    Set cnSCIROCCO = new ADODB.Connection

    cnSCIROCCO.Execute "bcp..."

    ExecuteComplete will trigger when it has completed. Of course this method will only work if you can do the bcp command through the connection object.
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

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