Link to home
Start Free TrialLog in
Avatar of Aravind Ranganathan
Aravind Ranganathan

asked on

Invalid Attempt to read when no data is present.

I am trying to run a sql query store it in a sqldatareader and then retrieve those values and want to store into a session to be used by another webform.

User generated image
the datareader says it hasrows but the error says no data is present its kind of a strange behavior.
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aravind Ranganathan
Aravind Ranganathan

ASKER

never mind fixed it but this could help anyone else looking for solution.

 while(myrdr.Read())
                    {
                        UserRole = myrdr["Role"].ToString();
                        UserPlant = myrdr["Plant"].ToString();  
                    }
thanks mate