Link to home
Start Free TrialLog in
Avatar of ba272
ba272

asked on

The OleDbCommand is currently busy Open, Fetching

Hi,

When I perform a query, followed by another query, the OleDbCommand is still busy.  How should I re-initialize this?

Thanks,
Bob

sql = "SELECT * FROM DeliveryRunDetail WHERE ProcessName='Test';
dbCommand1.CommandText = sql;
dbCommand1.ExecuteNonQuery();
                        
reader = dbCommand1.ExecuteReader();      
while ( reader.Read() )
{
    // do something
}                        

sql = "DELETE * FROM DeliveryRunDetail WHERE ProcessName='Test2'";
dbCommand1.CommandText = sql;
dbCommand1.ExecuteNonQuery();
Avatar of mogun
mogun

Close Reader before executing other SQL commands using the same command object.

Cheers
Mohan
SOLUTION
Avatar of BlackTigerX
BlackTigerX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Learned
Creating a new command instance would be better.

Bob
Avatar of ba272

ASKER

Hey Bob,

could you give an example so we're on the same page?

Bob
Bob,

Do you want to stick with the OleDbDataReader?

Bob
Avatar of ba272

ASKER

for now.  I've got quite a large program created.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ba272

ASKER

ok