DataReader - "Object Ref not set to instance ..."

onek

New member
Joined
Feb 1, 2006
Messages
1
Programming Experience
Beginner
Hello,
I am new to the .net environment, so kindly bear with me please ...
I am reading from a datareader (code below) and having exception/error
"object reference not set to an instance of an object" on RPrefID = dr("RELPREFID")...

dr = dh.ReturnDataReader(sqlString.ToString)
If dr.HasRows Then
while dr.read
RPrefID = dr("RELPREFID") //RPrefID is table's PK with Guid as datatype converted to raw in Table.
End While
End If
dr.Dispose()

I had performed similar 'operation' in different area in my code without any problem. What could I be doing wrong or happening? dr.Hasrows = true; dr.fieldcount = 1; db connections are done from the data access layer ...Any assistance will be very much appreciated - Thanks.
 
Back
Top