Should I close a datareader returned using daab?

  • Thread starter Thread starter hansiman
  • Start date Start date
H

hansiman

I'm unsure if I should call the close method (dr.Close()) of the
sqldatareader after the following code:

Dim dr As SqlDataReader
= SqlHelper.ExecuteReader(strConn,
CommandType.StoredProcedure, "SPROC", arParms)
If dr.Read Then
m_strValue = dr("Value")
End If


/M
 
Well, he wants to make sure that he closes his Connection as well.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
I'm pretty sure the DAAB uses CommandBehavior.CloseConnection as an
argument to ExecuteReader on the command object, meaning when you
close the reader the connection will be closed also
 
I try not to assume anything.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
Back
Top