將一個執行過的Recordset.close後,
再用同個Recordset重新執行某一SQL命令
但卻在Recordset.Open ....
出現下面Error msg...
"ADO 在應用程式所要求名稱或序數參照的相關集合中找不到物件。"
這是那出了錯??還是不行如此?
一定要先做
Set Recordset = Nothing
再重新建立Recordset
Set Recordset = New ADODB.Recordset
下面是我的部份程式碼
Dim LCNN As ADODB.Connection
Dim RST As ADODB.Recordset
Set LCNN = New ADODB.Connection
LCNN.Open "FILEDSN=MTS", "aaa", "aaa"
Set RST = New ADODB.Recordset
LSTR_SQL = "Select ITEM_NO,QTY " + _
"From ITEM "
With RST
.ActiveConnection = LCNN
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockBatchOptimistic
.Open LSTR_SQL, , , , adCmdText
.Close
End With
LSTR_SQL = "Select ITEM_NO,QTY " + _
"From ITEM "