Help .....System.InvalidOperationException: The SqlCommand is currently busy Open, Fetching.

G

Giox

Hello everybody
my program generate the following exception
"System.InvalidOperationException: The SqlCommand is currently busy
Open, Fetching."
when I delete a list of record from a database.
I have a listbox and with a foreach I loop inside the records of the
listbox and I delete the elements from the database.
When I execute the program I open the connection and I close it at the
end. I create the connection each time I call the method

Any idea?
 
M

Miha Markic [MVP C#]

Hi,

I would assume you have transaction problem - are you sure that you close
transaction and connection properly?
Is anybody else touching same records?
 
A

Alex Homer

Have you left a DataReader open on the connection? You can only have one
active query on a connetion in V1.x, though V2.0 allows more than one when
working against SQL Server 2005...
 
G

Giox

No, I use no datareader, I use dataadapter, sql command and datasets :-(

Alex Homer said:
Have you left a DataReader open on the connection? You can only have one
active query on a connetion in V1.x, though V2.0 allows more than one when
working against SQL Server 2005...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top