例如我有这个代码:
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
当连接关闭时数据读取器会发生什么(Conn.close)
数据读取器使用的光标会被释放吗?还是会保持开放?
如果数据读取器使用的游标仍然打开,什么时候会自动关闭?还是我应该手动关闭它?
它会导致可怕的“ORA-01000:超出最大打开游标”吗?
提前致谢