J
James P.
I'm trying to pass a sqlDataReader from a called function to a calling
function but got nothing back and a message saying "An unhandled
exception of type 'System.NullReferenceException' occurred in
Throw.exe. Object reference not set to an instance of an object."
Here is my code:
Public Function testint() As String
'Nothing returns here, plus the error above
Dim xp As SqlDataReader = getStoreProcedures("StoreProcedure")
End Function
Public Function getStoreProcedures() As SqlDataReader
Dim sp As SqlDataReader =
CCMSDB.DBDataReader("procSelectBatchReports")
'This sp.Read returns rows displayed in the message box fine.
While sp.Read
MsgBox(sp("StoreProcedure"))
End While
'This code works fine until here
getStoreProcedures = sp
'After this, when it returns to Testint, it will blow up
end function
Can anyone help please? I'm new to VB.NET. Thanks in advance,
James
function but got nothing back and a message saying "An unhandled
exception of type 'System.NullReferenceException' occurred in
Throw.exe. Object reference not set to an instance of an object."
Here is my code:
Public Function testint() As String
'Nothing returns here, plus the error above
Dim xp As SqlDataReader = getStoreProcedures("StoreProcedure")
End Function
Public Function getStoreProcedures() As SqlDataReader
Dim sp As SqlDataReader =
CCMSDB.DBDataReader("procSelectBatchReports")
'This sp.Read returns rows displayed in the message box fine.
While sp.Read
MsgBox(sp("StoreProcedure"))
End While
'This code works fine until here
getStoreProcedures = sp
'After this, when it returns to Testint, it will blow up
end function
Can anyone help please? I'm new to VB.NET. Thanks in advance,
James