运行到.Refresh时出现Operation is not allowed when the object is closed 错误
但是数据依然可以删掉。帮忙看一下要怎么改!谢谢 If MsgBox("確定刪除記錄? , vbQuestion + vbYesNo + vbDefaultButton2) = vbYes Then
With Adodc1
.CursorType = adOpenDynamic
.CommandType = adCmdText
.RecordSource = "delete from data where 編號 = " & Me.VSFlexGrid1.TextMatrix(Me.VSFlexGrid1.RowSel, 42) & " "
.Refresh
End With
MsgBox "數據刪除成功!", vbInformation
Else
MsgBox "數據刪除操作被取消!", vbExclamation
End If
但是数据依然可以删掉。帮忙看一下要怎么改!谢谢 If MsgBox("確定刪除記錄? , vbQuestion + vbYesNo + vbDefaultButton2) = vbYes Then
With Adodc1
.CursorType = adOpenDynamic
.CommandType = adCmdText
.RecordSource = "delete from data where 編號 = " & Me.VSFlexGrid1.TextMatrix(Me.VSFlexGrid1.RowSel, 42) & " "
.Refresh
End With
MsgBox "數據刪除成功!", vbInformation
Else
MsgBox "數據刪除操作被取消!", vbExclamation
End If
If MsgBox("確定刪除記錄? , vbQuestion + vbYesNo + vbDefaultButton2) = vbYes Then
With Adodc1
.CursorType = adOpenDynamic
.CommandType = adCmdText
.Recordset.ActiveConnection.Execute = "delete from data where 編號 = " & Me.VSFlexGrid1.TextMatrix(Me.VSFlexGrid1.RowSel, 42) & " "
End With
MsgBox "數據刪除成功!", vbInformation
Else
MsgBox "數據刪除操作被取消!", vbExclamation
End If