Hi I am developing a project which involves query strings. I want when user selects a city from a drop down list it has to be passed to the next page and show the values from the database in the gridview based on the value selected in drop downlist. My code is : protected void ddlCity_SelectedIndexChanged(object sender, EventArgs e) { string url = "Cityschedules.aspx?City="+ ddlCity.SelectedItem.Text; Response.Redirect(url); } When the user Enters say "New Delhi" It shud show the all the values where city is "New Delhi" In Cityschedules.aspx protected void Page_Load(object sender, EventArgs e) { try { string strSQLconnection = "Data Source=SHASHI-56B0C28E\\SQLEXPRESS;Initial Catalog=Project_Airways;Persist Security Info=True;User ID=sa;Password=sql2005"; SqlConnection sqlConnection = new SqlConnection(strSQLconnection); SqlCommand sqlCommand = new SqlCommand("SELECT * FROM [ARS_Schedules] WHERE ([Origin_Place] = '@Origin_Place1')", sqlConnection); sqlConnection.Open(); string Origin_Place1 = Request.QueryString["City"]; SqlDataReader reader = sqlCommand.ExecuteReader(); GridView1.DataSource = reader; GridView1.DataBind(); } catch (SqlException se) { Console.WriteLine(se.Message); } finally { sqlConnection.close(); } } I am getting exceprion "{"The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource. A control with ID 'SqlDataSource1' could not be found."}" Also when this exception is solved i am getting another exception saying "Must declare scalar variable @origin_Place1" Thanks in advance regards shashi
S
shashi_code
@shashi_code