string strName; string strPhone; string strAddress;string sql = "select * from [tb] where 0=0"; if (strName!="") sql=sql+" and [name]='"+strName+"'"; if (strPhone!="") sql=sql+" and phone = '"+strPhone+"'"; if (strAddress!="") sql=sql+" and address= '"+strAddress+"'";
string strPhone;
string strAddress;string sql = "select * from [tb] where 0=0";
if (strName!="")
sql=sql+" and [name]='"+strName+"'";
if (strPhone!="")
sql=sql+" and phone = '"+strPhone+"'";
if (strAddress!="")
sql=sql+" and address= '"+strAddress+"'";