Vb6 关闭对象时不允许vb 6 adodc操作
我正在尝试更新一些记录。当Adodc2.Refresh行执行时,我收到一条错误消息,说“当对象关闭时,不允许操作” 然而,当我输入“On Error Resume Next”时,它会按照我的要求更新记录。请帮帮我谢谢 这是我的密码:Vb6 关闭对象时不允许vb 6 adodc操作,vb6,Vb6,我正在尝试更新一些记录。当Adodc2.Refresh行执行时,我收到一条错误消息,说“当对象关闭时,不允许操作” 然而,当我输入“On Error Resume Next”时,它会按照我的要求更新记录。请帮帮我谢谢 这是我的密码: Dim intResponse As Integer intResponse = MsgBox("Are you sure you want to delete Status?", _ vbYesNo + vbQuestion, _
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
如果它正确地更新了记录,那么这可能不是您的问题。试着注释你的最后一行(
Adodc1.Refresh
),看看你是否仍然收到错误。我将adodc2更改为Adodc1。我没有收到任何错误,但我的问题是它没有更新。你能在原始帖子中更新你的代码吗?有时这意味着你提供的SQL在某种程度上有缺陷。尝试在状态
字段周围放置方括号,如:[status]
。另外,最好使用Access编写自己的查询,然后将SQL复制到VB应用程序中。