|
Teachers, please help me to see what is wrong with my program
I will select or fill in the content on the first page to the second page, but there is a lot of content to be passed
I wrote this
Response.Redirect("http://localhost/sycar/cn/find2.aspx?type='"+ddl1.SelectedItem.Text.ToString()+"'&name='"+tbname.Text.ToString()+" '&price='"+ddl3.SelectedItem.Text.ToString()+"'&year='"+ ddlyear.SelectedItem.Text.ToString()+"'&month='"+ddlmonth.SelectedItem.Text.ToString()+ "'&day='"+ddlday.SelectedItem.Text.ToString()+"'&area='"+ddl5.SelectedItem.Text.ToString()+"'&dang='"+ddl6.SelectedItem.Text.ToString() +"'&oil='"+ddl7.SelectedItem.Text.ToString()+"'");
The second page is written like this
string type1=Page.Request.QueryString["type"].ToString().Trim();
string name1=Page.Request.QueryString["name"].ToString().Trim();
string price1=Page.Request.QueryString["price"].ToString().Trim();
string year1=Page.Request.QueryString["year"].ToString().Trim();
string month1=Page.Request.QueryString["month"].ToString().Trim();
string day1=Page.Request.QueryString["day"].ToString().Trim();
To
string area1=Page.Request.QueryString["area"].ToString().Trim();
string dang1=Page.Request.QueryString["dang"].ToString().Trim();
string oil1=Page.Request.QueryString["oil"].ToString().Trim();
To
strSql="select * from zcar where 1=1";
if(type1!="")
{
strSql +=" and type='"+type1+"'";
To
}
if(name1!="")
{
strSql +=" and name='"+name1+"'";
To
}
if(price1!="")
{
strSql +=" and price='"+price1+"'";
}
if(year1!="")
{
strSql +=" and yizumoyear<'"+year1+"'";
}
if(month1!="")
{
strSql +=" and yizumomonth<'"+month1+"'";
}
if(day1!="")
{
strSql +=" and yizumoday<'"+day1+"'";
}
if(area1!="")
{
strSql +=" and suozaidi='"+area1+"'";
}
if(dang1!="")
{
strSql +=" and chedang='"+dang1+"'";
}
if(oil1!="")
{
strSql +=" and ranyou='"+oil1+"'";
}
But when running, when I select a content on the first page, I always make a mistake on the second page and say that there is a syntax error near the content I selected. |
|