Hi,
I'm having problem when I read more then one datareaders in row. The second one always get exception. I know this is one of the favourite topics of ADO.NET, but could not solve my problem no matter what I do. I use a class to prepare my datareader. If only one reading no problem so far. But with two readings it does not work. I even tried the first reading without using a DAL class, instead just did it on the main line it works but when I use the DAL class for the second reading I get exception.

I appreciate any help,
Thanks,
snky

Recommended Answers

All 3 Replies

What type of exception is it? What does the message of the Exception read?

Hi,
İt is " System.Exception {Syste.NullReferenceException} "
In the second datareading I get it. If I use this datareading as the only datareading then there is no problem. I'm having this exc. on the second datareading attempt no matter what method I use to access datasource

I think I solved it,

After finishing with the first read phase I was using "read.close();" which really did not clean up the mess, so the second reader could not succeed. Instead of " read.close()" , I used "read.dispose()", that did the thing ok.
snky

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.