用的是系统数据库:pubs。表是:sales,stores
要实现的是对结果进行过滤:
protected void Page_Load(object sender, EventArgs e)
    {
        if(!Page.IsPostBack)
        {
            string ConnectionString=ConfigurationSettings.AppSettings["MSDEconnectString"];
            SqlConnection myconnection=new SqlConnection(ConnectionString);
            try
            {
                string CommandText="select stor_id,stor_name from stores";
                SqlCommand myCommand=new SqlCommand(CommandText,myconnection);
                myconnection.Open();
                DropDownList1.DataSource=myCommand.ExecuteReader();
                DropDownList1.DataTextField="stor_name";
                DropDownList1.DataValueField="stor_id";
                DropDownList1.DataBind();
                DropDownList1.Items.Insert(0,new ListItem("--all stor_name--","0"));
            }
           catch(Exception ex)
          {
              throw(ex);
          }
            finally
            {
                myconnection.Close();            }
        }
     
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string ConnectionString = ConfigurationSettings.AppSettings["MSDEconnectString"];
        SqlConnection connstr = new SqlConnection(ConnectionString);
        try
        {   
            string cmdtext = "select sales.title_id,stores.city from sales INNER JOIN stores on sales.stor_id=stores.stor_id";
            string value=DropDownList1.SelectedValue;
            if(value!="0")
            {
                cmdtext+="where sales.stor_id="+value;
                cmdtext+="order by sales.title_id";
            }
            SqlCommand cmd2 = new SqlCommand(cmdtext, connstr);
            connstr.Open();
            GridView1.DataSource = cmd2.ExecuteReader();
            GridView1.DataBind();
        }
        catch(Exception es)
        {
            throw (es);            
        }
        finally 
        {
            connstr.Close();
        }
     
        
    }报错:第一行"sales"附近有语法错误!
为什么?