views:

18

answers:

1

Can anyone help me on how this error came up

There is already an open DataReader associated with this Connection which must be closed first.

the error fails when it trying to read this code.

transConn = mySqlConn.BeginTransaction(IsolationLevel.ReadCommitted)

Is there is a connection between the Datareader and in initializing the transaction?

Can anyone help me on how can I fix this bugs.

Thanks peeps! :)

+1  A: 

Close the DataReader before you begin the transaction.

See here: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.close.aspx

It says:

"You must explicitly call the Close method when you are through using the SqlDataReader to use the associated SqlConnection for any other purpose."

Mamta Dalal
thanks peeps, it works :)
Zen
well, you can accept the answer and optionally upvote the answer.
Mamta Dalal