Kelly,
What namespace does the SQLHelper reside, I could not find it in the help?
I use a similar pattern for returning a row or rows of data and do not have
a problem (shown below). As I suggested before the error must reside in
some where in/around SQLHelper because the reader is not properly
instantiated, (perhaps the connect string is incorrect).
Even if your query does not return rows the Reader.Read method should return
a value.
Dan
If rdr.Read() Then
...
End If
While rdr.Read
...
End While
"Kelly E" <an*******@discussions.microsoft.com> wrote in message
news:07****************************@phx.gbl...
SqlHelper is the MS Application Block object. The
application blocks are classes MS built to make our lives
easier in writing data access code. I use the object
everywhere in this project.
-----Original Message-----
What is SQLHelper? Your errro probably orginates there.
"Kelly E" <an*******@discussions.microsoft.com> wrote in
messagenews:14*****************************@phx.gbl... Here's my function. I keep getting 'Object not set to an instance of an object when I call myDR.Read. (I'm using the Application Data blocks v1). I have similar routines throughout this project that work - I don't see any code differences. Any suggestions???
Private Function GetOrderSessionId(ByVal OrderId As
Integer) As String
Dim myDR As SqlDataReader
myDR = SqlHelper.ExecuteReader
(ConfigurationSettings.AppSettings ("connectionString"), _ CommandType.Text, "Select SessionId from
Orders where OrderId = " & OrderId)
If myDR.Read = True Then 'ERROR HERE
Return myDR("SessionId")
End If
myDR.Close()
End Function
.