I got an error saying "There is already an open DataReader associated with this Command which must be closed first". I have only used datareader once while using the same connection for my dataset. Would that make some conflict? Need help.

Would you mind showing the code?
The problem is becuase you have already opened the dataReader. For sure you have a loop and you are trying to open already opened dataReader.
Double check the code, if you do not find an error, please paste the code in here.

Mitja

Make sure that the connection to the database is open when doing reader.Read()

This is not the point here, it would have beed other error.
The problem is that he (as far as am think) wants to create 2nd reader, when 1st one is nor even closed yet.
If so, Close() 1st reader and set it to null (reader = null;) and then create another reader (as the 1st one).

Hope it helps,
Mitja

This is not the point here, it would have beed other error.
The problem is that he (as far as am think) wants to create 2nd reader, when 1st one is nor even closed yet.
If so, Close() 1st reader and set it to null (reader = null;) and then create another reader (as the 1st one).

Hope it helps,
Mitja

I had that exact error two days ago when closing the database connection before reading with the reader. It's an easy thing to check so it's worth a quick try.

This article has been dead for over six months. Start a new discussion instead.