S
sam
Hello group,
I have a function which is used to initiate sqlDataReader
object.
I was trying to invoke the close method on the DataReader object but
cant really do that as the function returns a datareader and cannot
access the datareader once the connection is closed.
Here is what I do:
public function getDataReader() as datareader
oCmd.Connection.Open() ( oCmd - command object)
Dim oDr As SqlDataReader =
oCmd.ExecuteReader(CommandBehavior.CloseConnection)
' cant add a odr.close()
Return oDr
End Function
How do I close a datareader explicitly and access it outside the
function.
Thanks,
Chris.
I have a function which is used to initiate sqlDataReader
object.
I was trying to invoke the close method on the DataReader object but
cant really do that as the function returns a datareader and cannot
access the datareader once the connection is closed.
Here is what I do:
public function getDataReader() as datareader
oCmd.Connection.Open() ( oCmd - command object)
Dim oDr As SqlDataReader =
oCmd.ExecuteReader(CommandBehavior.CloseConnection)
' cant add a odr.close()
Return oDr
End Function
How do I close a datareader explicitly and access it outside the
function.
Thanks,
Chris.