//获得搜索参数开始
string SearchTypes = DDL_SearchTypes.Text;
string Key = tb_Key.Text.ToString();
string str_c = "";
if (SearchTypes != "" && Key != "")
{
intPageNo = 1;
str_c = "And " + SearchTypes + " Like '" + '%' + Key + '%' + "'";
Response.Cookies["strc"].Value =str_c;
}
string str_Condition = Request.Cookies["strc"].Value;
Response.Write(str_Condition);
//获得搜索参数结束 //查询条件,不需where"
workParm = mySqlCommand.Parameters.Add("@strCondition", SqlDbType.VarChar, 500);
mySqlCommand.Parameters["@strCondition"].Value = str_Condition;
问题如下:
非要点两次搜索才能搜索到正确结果我换关键字的时候,我用Response.Write(str_Condition);输出时,第一次还是输出了老Cookies的内容,非要第二次点搜索才会正确显示,是怎么一回事,请高手指点
string SearchTypes = DDL_SearchTypes.Text;
string Key = tb_Key.Text.ToString();
string str_c = "";
if (SearchTypes != "" && Key != "")
{
intPageNo = 1;
str_c = "And " + SearchTypes + " Like '" + '%' + Key + '%' + "'";
Response.Cookies["strc"].Value =str_c;
}
string str_Condition = Request.Cookies["strc"].Value;
Response.Write(str_Condition);
//获得搜索参数结束 //查询条件,不需where"
workParm = mySqlCommand.Parameters.Add("@strCondition", SqlDbType.VarChar, 500);
mySqlCommand.Parameters["@strCondition"].Value = str_Condition;
问题如下:
非要点两次搜索才能搜索到正确结果我换关键字的时候,我用Response.Write(str_Condition);输出时,第一次还是输出了老Cookies的内容,非要第二次点搜索才会正确显示,是怎么一回事,请高手指点
string SearchTypes = DDL_SearchTypes.Text;
string Key = tb_Key.Text.ToString();
string str_c = " ";
if (SearchTypes != " " && Key != " ")
{
intPageNo = 1;
str_c = "And " + SearchTypes + " Like ' " + '% ' + Key + '% ' + " ' ";
// 这里加上 ,,str_Condition =str_c;
Response.Cookies[ "strc "].Value =str_c;
}
string str_Condition = Request.Cookies[ "strc "].Value;
Response.Write(str_Condition);
//获得搜索参数结束
//查询条件,不需where "
workParm = mySqlCommand.Parameters.Add( "@strCondition ", SqlDbType.VarChar, 500);
mySqlCommand.Parameters[ "@strCondition "].Value = str_Condition;