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
You have to close your reader instead of closing the connection. Have a look here:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.close.aspx