I am calling some stored Procedure, having selct statment, after inserting some a new data entry by different stored procedure.
Some times my Select stored procedure does not return any value. Data is exactly correct and when I explicitly called that SP with same data by Query analyzer, I will got the desired result.
The error I have got is System.Data error in vb.Net, due to empty DataReader. Strange is that dataReader is return true when I am calling dr.read(). Not getting exact solution.
Software/Hardware used:
ASKED:
February 1, 2008 2:35 PM
UPDATED:
July 19, 2008 6:20 AM
I have got the solution, I have used architecture such that, I have got the datareader object, which I have assigned in my loca dataReader having scope in a method.
From this method I have passed my datareader with reference to a different method, where I perform the read operation.
Many times this .Net code work properly, But some times it won’t work because .Net GC already remove my datreader object, when I am passing datareader to different method.
I have change variable scope to a class level and now it will work properly. The important thing is that I am using autoclose functionality of dataReader.