Do I need to add a pause betwen multiple update queries using OLE DB and Access?

Posted on 2005-04-07
Last Modified: 2010-04-23
I am using VB.NET with OLE DB, and Access.

I have a routine wich loops through and executes multiple update, make table, and delete table queries.

Do I have to add a pause after each querty before I run the next one? Should I close the connection after each query, or should I keep it open?


Question by:brokeMyLegBiking
    LVL 8

    Expert Comment

    nope if u are using data reader, u will have to close the reader in order for u to run the next statement.

    LVL 14

    Assisted Solution

    From your description, sounds like you are using OleDbCommand, not OleDbDataAdapter. But I'll talk about both:

    If you are using OleDbDataAdapter, you don't need to pause or worry about the connection, the dataadapter handles connection automatically for you. Normally you make all changes to dataset first, then call OleDbDataAdapter.Update():
       For ...
           'Changes to the dataset
    This can be used for an existing table.

    If you are using OleDbCommand, you don't need to pause either. Open and close connection outside the loop:
           myOleDbCommand = "your query"
    LVL 19

    Accepted Solution

    And for the actual question
    >> Do I have to add a pause after each query


    When you say
    it is a "SYNCHRONOUS  CALL" that means unless the command is completed the next command is not executed, so you need not pause the system automatically pauses for you (since it is a synchronous call)

    Now starting with .NET Framework 2.0 Asynchronous calls are also possible but the syntax for that is separate (BeginExecuteNonQuery) I don't think you are using that so do not worry about the pause.


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now