how to write query based on dropdownlist price range
in my shopping website i wabt to show the data from database based on dropdownlist price range selection
eg: 0-10 means bind data based on price 0to 10 like that
i already writen code is below .please give correctly
protected void Button1_Click(object sender, EventArgs e)
{
string query = "SELECT * FROM fruitlist where fruitprice=@price or @price=''";
SqlCommand cmd = new SqlCommand(query);
cmd.Parameters.AddWithValue("@Country", DropDownList1.SelectedItem.Value);
using (SqlConnection con = new SqlConnection(s))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataSet ds = new DataSet())
{
sda.Fill(ds);
DataList1.DataSource = ds;
DataList1.DataBind();
}
}
}
}
thank you