If check_ZongHe_JiaGe.Value = 1 Then
ElseIf combo_JiaGe.Text = "<10元" Then
sql = "select * from books where bk_pri < 10"
ElseIf combo_JiaGe.Text = "<20元" Then
sql = "select * from books where bk_pri < 20"
ElseIf combo_JiaGe.Text = "<50元" Then
sql = "select * from books where bk_pri < 50"
ElseIf combo_JiaGe.Text = "<100元" Then
sql = "select * from books where bk_pri < 100"
ElseIf combo_JiaGe.Text = ">50元" Then
sql = "select * from books where bk_pri > 50"
ElseIf combo_JiaGe.Text = ">100元" Then
sql = "select * from books where bk_pri > 100"
End Ifcn.ConnectionString = "driver={SQL Server};" & _
"server=note;uid=;pwd=;database=pubs"
cn.CursorLocation = adUseClient
cn.Openrs.CursorLocation = adUseClient
rs.Open sql, cn, adOpenKeyset, adLockOptimistic
ElseIf combo_JiaGe.Text = "<10元" Then
sql = "select * from books where bk_pri < 10"
ElseIf combo_JiaGe.Text = "<20元" Then
sql = "select * from books where bk_pri < 20"
ElseIf combo_JiaGe.Text = "<50元" Then
sql = "select * from books where bk_pri < 50"
ElseIf combo_JiaGe.Text = "<100元" Then
sql = "select * from books where bk_pri < 100"
ElseIf combo_JiaGe.Text = ">50元" Then
sql = "select * from books where bk_pri > 50"
ElseIf combo_JiaGe.Text = ">100元" Then
sql = "select * from books where bk_pri > 100"
End Ifcn.ConnectionString = "driver={SQL Server};" & _
"server=note;uid=;pwd=;database=pubs"
cn.CursorLocation = adUseClient
cn.Openrs.CursorLocation = adUseClient
rs.Open sql, cn, adOpenKeyset, adLockOptimistic
出错信息贴出来看看.
出错信息是:“没有为命令对象设置命令“
我调试的时候总是显示 sql=""
是不是这个条件不成立
我定义的如果不选中的话combo_JiaGe.enable=false的
If check_ZongHe_JiaGe.Value = 1 Then
If combo_JiaGe.Text = "<10元" Then
sql = "select * from books where bk_pri < 10"
ElseIf combo_JiaGe.Text = "<20元" Then
sql = "select * from books where bk_pri < 20"
ElseIf combo_JiaGe.Text = "<50元" Then
sql = "select * from books where bk_pri < 50"
ElseIf combo_JiaGe.Text = "<100元" Then
sql = "select * from books where bk_pri < 100"
ElseIf combo_JiaGe.Text = ">50元" Then
sql = "select * from books where bk_pri > 50"
ElseIf combo_JiaGe.Text = ">100元" Then
sql = "select * from books where bk_pri > 100"
EndIf
End If
If check_ZongHe_JiaGe.Value = 1 Then
'这里的判断有问题了,怎么会是elseif呢
ElseIf combo_JiaGe.Text = "<10元" Then
————————
End If
当你的checkbox选中后,并没有给sql设置语句阿
你在重新看一下