上网搜多条件查询,一大把啊!
public static string GetSearchString(string testTime,string taste,string oversight,string area,string city,string place)
{
string SELECT_STRING = "select Project.*,[Plan].Taste,tb_city.city as sCity,tb_venues.Venues as sPlace from Project,[Plan],tb_city,tb_venues,tb_area where " +
"1=1 ";
if (testTime != "")
SELECT_STRING += " and BeginDate='" + testTime + "'";
if (taste != "")
SELECT_STRING+=" and Taste like '%"+taste+"%'";
if (oversight != "")
SELECT_STRING += " and OverSight='" + oversight + "'";
if (area != "")
SELECT_STRING += " and Project.Place in (select VID from tb_city,tb_area,tb_venues where tb_area.AID=tb_City.AID and tb_city.CID=tb_venues.CID and Area='"+area+"')";
if (city != "")
SELECT_STRING += " and tb_city.City='" + city + "'";
if (place != "")
SELECT_STRING += " and tb_venues.Venues like '%" + place + "%'";
return SELECT_STRING;
}