sql data reader issue.

  • Thread starter Thread starter Ratman
  • Start date Start date
R

Ratman

I have the following code:

Public Sub SelectAdminUserByID()

Try

Dim oDR As SqlDataReader =
oData.ExecuteReader(sConnectionString, CommandType.StoredProcedure,
"spSelectAdminUserByID")

'If oDR.HasRows Then
Do While oDR.Read()
Username = CType(oDR.Item("Username"), String)
Password = CType(oDR.Item("Password"), String)
Active = CType(oDR.Item("Active"), Boolean)
Loop
'End If

oDR.Close()

oDR = Nothing
oData = Nothing

Catch ex As Exception

End Try

End Sub

I am getting a "Object reference not set to an instance of an object."
error. It is bombing on the first reference to oDR. Can someone
please point out the problem here.
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top