Search Vuncher


SUBMITTED BY: openeyes

DATE: April 23, 2016, 8:20 a.m.

FORMAT: C#

SIZE: 918 Bytes

HITS: 47593

  1. private void search_vuncher()
  2. {
  3. SqlConnection con = new SqlConnection(dbclass.constring);
  4. try
  5. {
  6. string query = "SELECT Vuncher from tbl_customer";
  7. SqlCommand cmd = new SqlCommand(query, con);
  8. con.Open();
  9. SqlDataReader reader = cmd.ExecuteReader();
  10. AutoCompleteStringCollection Mycollection = new AutoCompleteStringCollection();
  11. while (reader.Read())
  12. {
  13. Mycollection.Add(reader.GetString(0));
  14. }
  15. txt_vuncher.AutoCompleteCustomSource = Mycollection;
  16. con.Close();
  17. }
  18. catch (Exception ex)
  19. {
  20. MessageBox.Show(ex.Message);
  21. }
  22. finally
  23. {
  24. con.Close();
  25. }
  26. }

comments powered by Disqus