Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  2. {
  3. {
  4. SqlConnection cn = new SqlConnection(@"Data Source=(LocalDB)v11.0;AttachDbFilename=E:Documentsbasededadospap.mdf;Integrated Security=True;Connect Timeout=30");
  5. try
  6. {
  7. cn.Open();
  8. string query = "select * from fornecedor where nomefornecedor='" + comboBox1 + "'";
  9. SqlCommand createCommand = new SqlCommand(query, cn);
  10. SqlDataReader dr = createCommand.ExecuteReader();
  11. cn.Close();
  12. }
  13.  
  14. catch (Exception ex)
  15. {
  16. MessageBox.Show(ex.Message);
  17. }
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement