比如 说~~if text1.enable=true then 
             strsql="select * from cs_info where 姓名=' " &trim(text1.text) & "'"
             excutesql(strsql)
          end if
因为是复选框这样回很麻烦 ~ 请求帮助~~~~~~~~~~~~~~~~~~~~

解决方案 »

  1.   

    组合SQL语句?比如:dim sql as string
    dim s1 as string,s2 as stringsql="select * from tb where 1=2 "if 满足条件1 then
       s1=" and fld1='abc' "
    end ifif 满足条件2 then
       s2=" and fld2=123 "
    end ifsql =sql & s1 & s2cn.execute sql
      

  2.   

    做成控件數組,如
    chk1 chk2 chk3
    定義數組g(3)
    for i=1 to 3
    g(i-1)=chk1.caption
    next
    strSQL="select * from cs_info where "
    for i=1 to 3
    if chk(i).value=1
      strSQL=strSQL& "g(i-1)='" & chk(i).text & " '"
    endif
    next
    g_cn.execute(strSQL)
      

  3.   

    strsql = "select * from cs_info where 1=1"
           If Text1.Enabled = True Then
            strsql = strsql & " and cname=" & Trim(Text1.Text)
           End If运行后 点种一个复选框 按 名字 搜索 出现如下错误:至少一个参数没有被指顶值
      

  4.   

    strsql = "select * from cs_info where 1=1"If Text1.Enabled = True Then
        strsql = strsql & " and cname='" & Trim(Text1.Text) "'"
    End If