有姓名,性别,身份证号,年龄段,户号在后台做查询该怎么写
求高手指点指点给个思路和方法!

解决方案 »

  1.   

    我是新手,自己做的if--else实在是太长了求高手指点一下该怎么写
      

  2.   

    类似下面这样string strWhere=" where 1=1 ";
    if(txtName.Text.Length>0)
       strWhere += " and name like '%" + txtName.Text + "%' ";
    if(txtICCode.Text.Length>0)
       strWhere += " and ICCodelike '%" + txtICCode.Text + "%' ";...string strSql="select * from 表 " + strWhere;
    ...
      

  3.   


    select * from t_table 
    where
    name like '%张%' --------(条件1有值的话)
    and age > 18     --------(条件2有值的话)
    ...
    说穿了就是拼sql语句
      

  4.   

    StringBuilder sqlstr=“select * from table where 1=1”
    if(string.IsNullOrWhiteSpace ( nametextbox.text)){
    sql.appendformat(“ and 姓名=‘{0}’”, nametextbox.text )
    }//或者like
    后面同理,手机打字难,请理解
      

  5.   


    把条件列出来,然后根据条件下SQL语句就可以了