where check1.value=1 控件-0 是没有检查(缺省值),1 为已检查,和 2 为变灰(变暗)。
在按确定按钮的事件里打判断的代码If Check1.Value = 1 Then Str = Check1.Caption sqlStr = "select * from tbl where " + str + "='" + Text1.Text + "'" End If
选择一个查询条件的话,为什么不能用 "select * from table where str=check1.caption" 如果我是多个查询条件,必须用 "select * from table where str1=check1.caption and str2=check2.caption and ...."
to dylan0428: 这样的话,不知那一个被选择了,所以你应有一个判断选择的语句,可用if语句,逐个判断。
控件-0 是没有检查(缺省值),1 为已检查,和 2 为变灰(变暗)。
Str = Check1.Caption
sqlStr = "select * from tbl where " + str + "='" + Text1.Text + "'"
End If
如果我是多个查询条件,必须用 "select * from table where str1=check1.caption and str2=check2.caption and ...."
这样的话,不知那一个被选择了,所以你应有一个判断选择的语句,可用if语句,逐个判断。
str = str + " and" & " " & "规划办理情况=-1"
然后把字符串前面的 " and" & " " 用mid(6,i,1)去掉了,不知是不是常用的方法.