If khbh1.Checked = True Then
              khbh2.Enabled=true 
              else
             khbh2.Enabled=False 
              end if 
              
            If khmc1.Checked = True Then
              khmc2.Enabled=true 
               else
              khmc2.Enabled=False 
            end if 
     ... strsql ="select * from  khzl where   ~~~~~
应该怎么设计???

解决方案 »

  1.   

    你不要急,慢慢把问题说清楚了先..strsql ="select * from  khzl where 1=1";你如果是要根据checkbox是否已经选择而查询数据的话,这么写:If khbh1.Checked = True Then
                  khbh2.Enabled=true 
                  strsql += " and khbh='值'";    //注意这里的用法              else
                 khbh2.Enabled=False 
                  end if 
                  
                If khmc1.Checked = True Then
                  khmc2.Enabled=true 
                  strsql += " and khmc='值'";      //注意这里的用法               else
                  khmc2.Enabled=False 
                end if 
      

  2.   

    这个问题问的有点模糊,IF语句究竟跟SELECT语句有什么关系楼主你应该表达清楚。
      

  3.   

    strsql ="select * from  khzl where";   
    If khbh1.Checked = True Then
                  khbh2.Enabled=true 
                  strsql += "khbh='"+khbh2.Text+"'";    
                  else
                 khbh2.Enabled=False 
                  end if 
                  
                If khmc1.Checked = True Then
                  khmc2.Enabled=true
                  strsql += " and khmc='"+khmc2.Text+"'";    
                   else
                  khmc2.Enabled=False 
                end if 
    最后取到strsql的值
      

  4.   

    呵呵
    一个问题,后来变成了joke版的东西有趣