jfsedlar3rd
asked on
Datareader error: Object reference not set to an instance of an object.
I am writing an ASP.NET application. I am using a data reader object the way the code flows is that sometimes it gets instantiated and sometimes it doesnt. This is causing some issues because I am using a data reader multiple times in a subroutine so I have to close it before I can create a new one. However if it skips over the code that instantiates it when it hits the code to check if its open:
If Not dReader.IsClosed Then
dReader.Close()
End If
I am getting an error. System.NullReferenceExcept ion: Object reference not set to an instance of an object. Does anyone know how to check if this object has been instantiated already?
If Not dReader.IsClosed Then
dReader.Close()
End If
I am getting an error. System.NullReferenceExcept
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER