For example, I have this code:
Sub Month() Dim Conn As New Data.OracleClient.OracleConnection Conn.Open() Try Dim Cmd As New Data.OracleClient.OracleCommand With Cmd .Connection = Conn .CommandType = Data.CommandType.Text .CommandText = "SELECT * FROM MONTH" End With Dim datareader As Data.OracleClient.OracleDataReader = Cmd.ExecuteReader While datareader.Read Response.Write(datareader(0)) End While Catch ex As Exception Throw ex Finally Conn.Close() End Try End Sub
What happens to the data controller when the connection is closed (Conn.close)
Will the cursor used by the datareader be freed? or will he stay open?
If the cursor that the datareader is using is still open, when will it be automatically closed? or should I just close it manually?
Will this be the reason for the terrible "ORA-01000: maximum open cursors exceeded"?
early
source share