Hi
protected void lstcountry_SelectedIndexChanged(object sender, EventArgs e)
{
string qry = "select * from tbl_location where countrycode = " + lstcountry.SelectedValue;
SqlDataAdapter da = new SqlDataAdapter(qry, ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
DataSet ds = new DataSet();
da.Fill(ds);
grdlocation.DataSource = ds;
grdlocation.DataBind();
}
It is giving error "Incorrect Syntax near = "
Thanks
Error
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Dorababu MekaRank #457 · 5.5K reputationPosted Jul 20, 2011, 4:44 AM EDT
string qry = "select * from tbl_location where countrycode = '" + lstcountry.SelectedValue+"'";