Sunday, December 23, 2007

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

Some time ago I decide to query the database multiple times using only one connection and some Datareaders. My logic was that I can reduce the server load by doing so.

Having multiple DataReaders on one Database connection is not, in fact, practical. Each Datareader can be used only with one connection and a new conncetion is needed for the next Datareader.

No comments: