程序中有一function被反复调用,其中一句Set RecordSet=Connection.Execute(...)
在一台机子上执行没有问题,在另一台机子上执行总是在大概第50几次调用的时候说RecordSet不能被用来打开别的表了。不知有谁遇到过这个问题,还望指教
在一台机子上执行没有问题,在另一台机子上执行总是在大概第50几次调用的时候说RecordSet不能被用来打开别的表了。不知有谁遇到过这个问题,还望指教
Set RecordSet = New ADODB.RecordSet
recordset.open .....
....
recordset.close
set recordset = nothing
With Rs_Jc_Shhy_Csb
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = adoCN
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockBatchOptimistic
.Source = "SELECT * FROM Jc_Shhy_Csb WHERE hth='" & W_Jc_Shhy.Text1(0).Text & "'"
.Open
End With
RecordSet打开一次,就要关闭一次。
我按出错信息搜索,2147467259对应的是unspecified error
Only the ADO Connection object has an errors collection. The observant reader will notice that a lightweight error handler is in effect for the RecordSet.Open examples. In the event of an error opening a RecordSet object, ADO should return the most explicit error from the OLEDB provider. Some common errors that can be encountered with the code above are described below. If you omit (or there is an error in) the DefaultDir parameter in the connect string, you may receive the following error:
ADO Error # -2147467259
Description [Microsoft][ODBC Microsoft Access 97 Driver] '(unknown)'
isn't a valid path. Make sure that the path name is
spelled correctly and that you are connected to the server
on which the file resides.
Source Microsoft OLE DB Provider for ODBC Drivers
If there is an error in the Dbq parameter in the connect string, you may receive the following error: ADO Error # -2147467259
Description [Microsoft][ODBC Microsoft Access 97 Driver] Couldn't find
file '(unknown)'.
Source Microsoft OLE DB Provider for ODBC Drivers
The previously listed errors will also populate the Connection.Errors collection with the following errors: ADO Error # -2147467259
Description [Microsoft][ODBC Driver Manager] Driver's
SQLSetConnectAttr failed
Source Microsoft OLE DB Provider for ODBC Drivers ADO Error # -2147467259
Description Login Failed
Source Microsoft OLE DB Provider for ODBC Drivers
Note that for each error, the ADO Error number is the same, in this case translating to 0x80004005, which is the generic E_FAIL error message. The underlying Component did not have a specific error number for the condition encountered, but useful information was never-the-less raised to ADO. 有可能是connection对象连接时间过长而断开了,试试用字符串而不是用connection
如
recordset.open sSQL, sConn
Set recordset = connection.OpenSchema(...)
这句中我如何替换掉connection对象呢,因为openschema似乎是connection对象才有的方法
还望再次指教