[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

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

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?


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

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"
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now