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


The OleDbCommand is currently busy Open, Fetching -- CommandText

Posted on 2006-03-24
Medium Priority
Last Modified: 2012-05-07
In the code below, I get the error:

   "The OleDbCommand is currently busy Open, Fetching."

On the following line on the second time through:

   cmdReader2.CommandText = strSQL

How do I correct this?

While dreader1.Read()
   If Not dreader1.IsDBNull(2) Then
      If dreader1.GetString(2) = "F" OrElse IsNumeric(dreader1.GetString(2)) Then
         strSQL = "SELECT Field1 FROM Table1 WHERE Field2 = " & dreader1.GetInt32(0).ToString & " AND Field3 = 0"
         cmdReader2.CommandType = CommandType.Text
         cmdReader2.CommandTimeout = 0
         cmdReader2.CommandText = strSQL
         dreader2 = cmdReader2.ExecuteReader()
         While dreader2.Read
              dtDate = dreader2.GetDateTime(0)
         End While
         strSQL = "UPDATE Table1 SET Field4 = #" & dtDate & "# WHERE Field2 = " & dreader1.GetInt32(0).ToString
         cmdExecute.CommandType = CommandType.Text
         cmdExecute.CommandTimeout = 0
         cmdExecute.CommandText = strSQL
      End If
   End If
End While

<code removed per request http:Q_21903646.html>

Question by:GivenRandy

Accepted Solution

g_johnson earned 2000 total points
ID: 16281849
dreader2.close after end while ???

Author Comment

ID: 16281909
LMAO. Of course. That's why I needed a second set of eyes. Thanks!

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Integration Management Part 2
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

834 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