hi guys,
this is what I have currently in my data access layer:
'Open Connection stmt
.......
'The actual execution
Dim ObjDtReader As SqlDataReader = objComnd.ExecuteReader(CommandBehavior.SingleRow)
If (ObjDtReader.HasRows) Then
ObjDtReader.Read()
End If
return ObjDtReader
if you notice, i NEVER close the connection in that statement.
I have the following doubts:
1. Does the connection close automatically for CommandBehavior.SingleRow command behaviour? I was unabe to close the connection in the above method because the reader object has to be returned back to the calling code.
I close the reader object in the calling code. will that close the connection???
2. If not what is the best way to detect leaks? I tried using the sp_who, but all it said in query analyser was "AWAITING COMMAND". thats it.
any help is appreciated...
Known is handfull, Unknown is worldfull
this is what I have currently in my data access layer:
'Open Connection stmt
.......
'The actual execution
Dim ObjDtReader As SqlDataReader = objComnd.ExecuteReader(CommandBehavior.SingleRow)
If (ObjDtReader.HasRows) Then
ObjDtReader.Read()
End If
return ObjDtReader
if you notice, i NEVER close the connection in that statement.
I have the following doubts:
1. Does the connection close automatically for CommandBehavior.SingleRow command behaviour? I was unabe to close the connection in the above method because the reader object has to be returned back to the calling code.
I close the reader object in the calling code. will that close the connection???
2. If not what is the best way to detect leaks? I tried using the sp_who, but all it said in query analyser was "AWAITING COMMAND". thats it.
any help is appreciated...
Known is handfull, Unknown is worldfull