10
2012
04

asp.net 多重条件查询语句

按钮查询数据:
protected void ImageSelect_Click(object sender, ImageClickEventArgs e)
{
where.Text = "";
string contion = " where 1=1 ";//使用一个真条件,后面跟上搜索的条件,条件是否为空,都可以执行

if (Text1.Text.Trim() != "")
{
contion = contion + "and Text1 like '%" + Text1.Text.Trim() + "%'";
...
«1»