关于ADO(不是Ado.net)一些问题
问题是这样发现的,就是在vb.net 中使用ado(不是ado.net)操作数据库时,在大约200左右次数调用时,就会出现“不能再打开表”的错误,但不知是怎么回事,请高手帮助分析一下!代码如下:
我是把数据访问的操作封装成了一个数据库类,这是其中部分代码:
MyAdoDBConnection.ConnectionString = ConnectionString
MyAdoDBConnection.Open(_DataFileName, _UserName, _Password)
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;"
'执行SQL语句
Public Function ExecuteSQL(ByVal SQLCommandString As String) As ADODB.Recordset
Dim strSql As String
MyAdoDBRecordset = New ADODB.Recordset
MyAdoDBRecordset.CursorType = ADODB.CursorTypeEnum.adOpenStatic
MyAdoDBRecordset.LockType = ADODB.LockTypeEnum.adLockOptimistic
strSql = SQLCommandString
MyAdoDBRecordset.Open(strSql, MyAdoDBConnection) '打开记录集
Return MyAdoDBRecordset
调用:
_rstRecordset = Myadodb.ExecuteSQL("select max(Shortcode) from CustomTable")
问:1、跟释放资源有没有关系?
2、系统是不是对Recordset 有限制?