VB提示"对象打开时,不允许操作" 实时错误3705
PrivateSubaddhfText3_Click()addhfid.Enabled=Falseg_conn.Open'执行查询语句sql="selectcusname...
Private Sub addhfText3_Click()addhfid.Enabled = Falseg_conn.Open'执行查询语句sql = "select cusname from customer where cusid = '" + addhfid.Text + "'"If rss.State <> adStateClosed Then rss.Closerss.Openrss.Open sql, g_connrss.Closeg_conn.CloseIf rss.BOF = True ThenMsgBox "客户不存在!", vbInformationaddhfid.Enabled = TrueElseaddhfText3.Text = rss("cusname")End IfSet rss = NothingEnd Sub关键在于我都加了If rss.State <> adStateClosed Then rss.Close这句了,还是提示对象打开,真的不懂了,请教!
展开
3个回答
展开全部
Private Sub addhfText3_Click()
addhfid.Enabled = False
g_conn.Open
sql = "select cusname from customer where cusid = '" + addhfid.Text + "'"
If rss.State <> 2 Then rss.Close
rss.Open sql, g_conn, 1, 1
If rss.EOF Then
MsgBox "客户不存在!", vbInformation
Else
addhfText3.Text = rss("cusname")
End If
addhfid.Enabled = True
rss.Close
g_conn.Close
End Sub
addhfid.Enabled = False
g_conn.Open
sql = "select cusname from customer where cusid = '" + addhfid.Text + "'"
If rss.State <> 2 Then rss.Close
rss.Open sql, g_conn, 1, 1
If rss.EOF Then
MsgBox "客户不存在!", vbInformation
Else
addhfText3.Text = rss("cusname")
End If
addhfid.Enabled = True
rss.Close
g_conn.Close
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
addhfid.Enabled = Falseg_conn.Open' 这里都已经在打开了 后面加那个 有个毛用
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
addhfid.Enabled = Falseg_conn.Open'
你吧这句删除试试
你吧这句删除试试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询