注意一下SQL优化方面的就行,把能把查询范围缩小到最小的条件放在where的最后,按照这个逐渐把6个条件排序一下就行。
解决方案 »
- 用ASP.NET1.1 连接microsoft online services 通过OUTLOOK来发信
- 网页简单问题,请高手指导!----网页间数据传递
- ajax联动dropdownlist没实现
- 关于鼠标选中的操作~~
- URL传值问题。各位高手帮帮忙
- 求一个比较烦的正则表达式,请高人帮我,谢谢!
- DataGrid 怎么向另一个*.aspx 页传递参数?
- MVC 网站部署到.NET空间上出现Web 服务器被配置为不列出此目录的内容。
- 求助DataGrid的ItemDataBound方法问题。
- 微软的TreeView控件老是死的问题。。。以及我的解决方法
- 微软发布Vs2008 beta2 简体中文版
- 在textbox中输入查询条件时,文本框出现列表框,就象google搜索时一样的效果?
{
sqlwhere += " and a.infoclassid=" + strclass1value;
}
if (strclass2value != "-1")
{
sqlwhere += " and a.infotypeid=" + strclass2value;
}
if (sendCorp != "-1")
{
sqlwhere += " and a.departid ='" + sendCorp + "'"; }
if (strtitle != "")
{
sqlwhere += " and(";
string[] titles = Regex.Split(strtitle, @"\s+", RegexOptions.Compiled);
for (int i = 0; i < titles.Length; i++)
{
if (i != 0) sqlwhere += " or ";
sqlwhere += "a.title like '%" + titles[i] + "%'";
}
sqlwhere += ")";
//sqlwhere += " and a.title like '%" + strtitle + "%'";
}
然后
if(条件1 !="")
{
sql += " and ..."
}if(条件2 !="")
{
.............
}
string strs = "select * from biao "
int t=0;//记录条件数
if(DropDownList1.SelectedValue!=null)
{
if t=0
strs+=" where “;
else
strs+=" and“;
strs+=" city='" +this.DropDownList1.SelectedValue + "'";
} 其他选项依此类推·
int t=0;//记录条件数
if(DropDownList1.SelectedValue!=null)
{
if t=0
strs+=" where “;
else
strs+=" and“;
strs+=" city='" +this.DropDownList1.SelectedValue + "'";
t++;//
} 其他选项依此类推·
如:
选择第1个
select * from table where city=条件
选择第2个
select * from table where jyfs =条件
选择第1个和选择第2个
select * from table where city=条件1 and jyfs =条件2....
如此搜索
希望老兄帮忙
首先条件假如是满足的如
String strSQL="select * from member where 1=1 ";
'//下面开始判断
if(!name.equals("")) strSQL+=" and name like '%"+name+"%'";
if(!gender.equals("")) strSQL+=" and gender='""+gender+"'";