Guest User

Untitled

a guest
Jan 28th, 2016
78
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. protected void Button2_Click(object sender, EventArgs e)
  2. {
  3. string srchDescription = searchDescription.Text;
  4. string slctItem = DropDownList1.SelectedItem.ToString();
  5.  
  6. con.Open();
  7.  
  8. SqlCommand cmdForDescription = new SqlCommand("SELECT Описание FROM car_table WHERE Вносител = '" + slctItem + "'", con);
  9. string descriptionText = cmdForDescription.ExecuteScalar().ToString();
  10. bool containsDescription = descriptionText.Contains(srchDescription);
  11.  
  12. if (containsDescription)
  13. {
  14.  
  15. SqlCommand cmd = new SqlCommand("SELECT * FROM car_table WHERE Вносител = '" + slctItem + "'", con);
  16. SqlDataAdapter da = new SqlDataAdapter(cmd);
  17. DataSet ds = new DataSet();
  18. da.Fill(ds);
  19. GridView2.DataSource = ds;
  20. GridView2.DataBind();
  21. con.Close();
  22. Label2.Visible = true;
  23.  
  24. }
  25. }
RAW Paste Data