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

The OleDbCommand is currently busy Open, Fetching -- CommandText

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>

1 Solution
dreader2.close after end while ???
GivenRandyAuthor Commented:
LMAO. Of course. That's why I needed a second set of eyes. Thanks!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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