Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Can anyone help.

This is the coding for price ranges, but when click price range it does not show any products.
C#
protected void BulletedList3_Click(object sender, BulletedListEventArgs e)
  {

     string price = BulletedList3.Items[e.Index].Value;
      if (con.State == ConnectionState.Closed)
      {
          con.Open();
      }
      SqlCommand cmd = new SqlCommand("select pro_img,pro_name,price from product where price='" + price + "' and status='A' and type='retail'", con);
      SqlDataAdapter da = new SqlDataAdapter(cmd);
      DataSet ds = new DataSet();
      da.Fill(ds);
       DataList1.DataSource = ds;
      DataList1.DataBind();
      con.Close();
  }
Posted
Updated 21-Nov-11 3:27am
v2
Comments
Richard MacCutchan 21-Nov-11 12:26pm    
What is the value returned in price, and how many products match it?

1 solution

hi,

are u want the exact value?
and what is the data type of price in sql is it varchar?
you use = sign that means the exact values will match.
if no records with the input price is found then the result is not shown
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900