vb 6 adodc关闭对象时不允许操作

时间:2014-03-02 00:17:26

标签: vb6

我正在尝试更新一些记录。当Adodc2.Refresh行执行时,我收到一条错误消息,指出“当对象关闭时不允许操作” 然而,当我把“On Error Resume Next”放入时,它会按照我的意愿更新记录。请帮帮我谢谢..

这是我的代码:

     Dim intResponse As Integer
    intResponse = MsgBox("Are you sure you want to delete Status?", _
    vbYesNo + vbQuestion, _
    "Clinic System")
    If intResponse = vbYes Then
    Adodc2.CommandType = adCmdText
    Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\clinic.mdb" & ";Persist Security Info=False"
    Adodc2.RecordSource = "UPDATE patients Set Status = Null WHERE Status is not null"
    MsgBox "Record Deleted!", vbInformation, "Clinic System"
    Adodc2.Refresh
    Adodc1.Refresh
    End If

0 个答案:

没有答案