The OleDbCommand is currently busy Open, Fetching -- CommandText

Posted on 2006-03-24
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
    LVL 4

    Accepted Solution

    dreader2.close after end while ???
    LVL 9

    Author Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    This video discusses moving either the default database or any database to a new volume.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 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

    10 Experts available now in Live!

    Get 1:1 Help Now