how to close a sqlconnection in asp.net
Posted
by stighy
on Stack Overflow
See other posts from Stack Overflow
or by stighy
Published on 2010-05-17T15:27:54Z
Indexed on
2010/05/17
15:40 UTC
Read the original article
Hit count: 195
Hi guys, i would like to know if there's something wrong in this asp.net code:
mydatareader = mycmd.executeReader()
if myDataReader.HasRow then
// Do something
end if
myConnection.Close()
If i avoid to call a "MyDataReader.Close()" does the connection close anyway ? I ask this because i'm assuming that if call a "MyConn.Close" it automatically close the associated datareader... or am i wrong ?
Thanks
© Stack Overflow or respective owner