首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

求指点,多个文本框的条件查询如何写

2013-04-20 
求指点,多个文本框的条件查询怎么写有姓名,性别,身份证号,年龄段,户号在后台做查询该怎么写求高手指点指点

求指点,多个文本框的条件查询怎么写
有姓名,性别,身份证号,年龄段,户号在后台做查询该怎么写
求高手指点指点给个思路和方法!
[解决办法]
类似下面这样

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;
...

热点排行