vb与数据库sql2000问题
PrivateSubDT1_KeyDown(KeyCodeAsInteger,ShiftAsInteger)IfKeyCode=13Thenb=Str(DT1.Value...
Private Sub DT1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
b = Str(DT1.Value)
If i = 0 Then
frm_cxjg.Adodc3.RecordSource = "select * from Table_kfzz where " + Combo1.Text + " " + Combo2.Text + " '" + b + "'"
frm_cxjg.Adodc3.Refresh
If frm_cxjg.Adodc3.Recordset.RecordCount > 0 Then
frm_cxjg.Show
frm_cxjg.DataGrid1.Visible = False
frm_cxjg.DataGrid2.Visible = False
frm_cxjg.DataGrid3.Visible = True
frm_cxjg.DataGrid4.Visible = False
frm_cxjg.DataGrid5.Visible = False
frm_cxjg.Caption = "档案查询"
Else
MsgBox "没有您要查询的相关信息", 64, "医院住院管理系统"
End If
ElseIf i = 1 Then
frm_cxjg.Adodc3.RecordSource = "select * from Table_kfzz where " + Combo1.Text + " like '%" + b + "%'"
frm_cxjg.Adodc3.Refresh
If frm_cxjg.Adodc3.Recordset.RecordCount > 0 Then
frm_cxjg.Show
frm_cxjg.DataGrid1.Visible = False
frm_cxjg.DataGrid2.Visible = False
frm_cxjg.DataGrid3.Visible = True
frm_cxjg.DataGrid4.Visible = False
frm_cxjg.DataGrid5.Visible = False
frm_cxjg.Caption = "档案查询"
Else
MsgBox "没有您要查询的相关信息", 64, "医院住院管理系统"
End If
Else
End If
Else
End If
End Sub
运行定位在frm_cxjg.Adodc3.Refresh
对象refresh的方法iadodc失败 展开
If KeyCode = 13 Then
b = Str(DT1.Value)
If i = 0 Then
frm_cxjg.Adodc3.RecordSource = "select * from Table_kfzz where " + Combo1.Text + " " + Combo2.Text + " '" + b + "'"
frm_cxjg.Adodc3.Refresh
If frm_cxjg.Adodc3.Recordset.RecordCount > 0 Then
frm_cxjg.Show
frm_cxjg.DataGrid1.Visible = False
frm_cxjg.DataGrid2.Visible = False
frm_cxjg.DataGrid3.Visible = True
frm_cxjg.DataGrid4.Visible = False
frm_cxjg.DataGrid5.Visible = False
frm_cxjg.Caption = "档案查询"
Else
MsgBox "没有您要查询的相关信息", 64, "医院住院管理系统"
End If
ElseIf i = 1 Then
frm_cxjg.Adodc3.RecordSource = "select * from Table_kfzz where " + Combo1.Text + " like '%" + b + "%'"
frm_cxjg.Adodc3.Refresh
If frm_cxjg.Adodc3.Recordset.RecordCount > 0 Then
frm_cxjg.Show
frm_cxjg.DataGrid1.Visible = False
frm_cxjg.DataGrid2.Visible = False
frm_cxjg.DataGrid3.Visible = True
frm_cxjg.DataGrid4.Visible = False
frm_cxjg.DataGrid5.Visible = False
frm_cxjg.Caption = "档案查询"
Else
MsgBox "没有您要查询的相关信息", 64, "医院住院管理系统"
End If
Else
End If
Else
End If
End Sub
运行定位在frm_cxjg.Adodc3.Refresh
对象refresh的方法iadodc失败 展开
展开全部
有两个地方:
frm_cxjg.Adodc3.RecordSource = "select * from Table_kfzz where " + Combo1.Text + " " + Combo2.Text + " '" + b + "'"
frm_cxjg.Adodc3.Refresh
和
frm_cxjg.Adodc3.RecordSource = "select * from Table_kfzz where " + Combo1.Text + " like '%" + b + "%'"
frm_cxjg.Adodc3.Refresh
检查Select语法是否错误,方法在对应的语句前用Msgbox或debug.print输出该select语句进行检查:
例如在:
frm_cxjg.Adodc3.RecordSource = "select * from Table_kfzz where " + Combo1.Text + " like '%" + b + "%'"
前加一句:
msgbox "select * from Table_kfzz where " + Combo1.Text + " like '%" + b + "%'"
运行看看是什么结果?
frm_cxjg.Adodc3.RecordSource = "select * from Table_kfzz where " + Combo1.Text + " " + Combo2.Text + " '" + b + "'"
frm_cxjg.Adodc3.Refresh
和
frm_cxjg.Adodc3.RecordSource = "select * from Table_kfzz where " + Combo1.Text + " like '%" + b + "%'"
frm_cxjg.Adodc3.Refresh
检查Select语法是否错误,方法在对应的语句前用Msgbox或debug.print输出该select语句进行检查:
例如在:
frm_cxjg.Adodc3.RecordSource = "select * from Table_kfzz where " + Combo1.Text + " like '%" + b + "%'"
前加一句:
msgbox "select * from Table_kfzz where " + Combo1.Text + " like '%" + b + "%'"
运行看看是什么结果?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
1、连接到数据库的串写得有问题
2、加上:.CommandType = adCmdText
frm_cxjg.Adodc3.RecordSource = "select * from Table_kfzz where " + Combo1.Text + " like '%" + b + "%'"
frm_cxjg.Adodc3.CommandType = adCmdText
frm_cxjg.Adodc3.Refresh
可以百度HI找我。
2、加上:.CommandType = adCmdText
frm_cxjg.Adodc3.RecordSource = "select * from Table_kfzz where " + Combo1.Text + " like '%" + b + "%'"
frm_cxjg.Adodc3.CommandType = adCmdText
frm_cxjg.Adodc3.Refresh
可以百度HI找我。
追问
还是不行!感觉是连接到数据库的串写的有问题。请指点一下啊!应该就这这个有问题!其他没有什么问题。请问怎么修改啊???
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询