Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. protected void searchTheDB()
  2. {
  3. try
  4. {
  5. SqlConnection forSearch = new SqlConnection("Data Source=JAMES-PC;Initial Catalog=bitVerify;Integrated Security=True");
  6. SqlDataAdapter search = new SqlDataAdapter("SELECT compName As 'Company/Organization Name', btcAddr As 'Bitcoin Address', Premium_User as 'Premium User', upvote as 'Upvotes',downvote As 'Downvotes' FROM clientDataTable WHERE compName LIKE '%" + searchBox.Text + "%'", forSearch);
  7. DataSet dB = new DataSet();
  8. search.Fill(dB);
  9. searchGridView.DataSource = dB;
  10. searchGridView.DataBind();
  11. searchBox.Text = String.Empty;
  12. }
  13. catch (SqlException exp)
  14. {
  15. throw new InvalidOperationException("Sorry, the website is experiencing difficulties, please try again, error: ", exp);
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement