Advertisement
Guest User

Untitled

a guest
Jan 28th, 2016
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement