load data


SUBMITTED BY: openeyes

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

FORMAT: C#

SIZE: 736 Bytes

HITS: 51457

  1. private void load_data()
  2. {
  3. SqlConnection con = new SqlConnection(dbclass.constring);
  4. try
  5. {
  6. string query = "SELECT * from tbl_customer ";
  7. SqlCommand cmd = new SqlCommand(query, con);
  8. SqlDataAdapter adp = new SqlDataAdapter(cmd);
  9. DataTable datatable = new DataTable();
  10. adp.Fill(datatable);
  11. this.Grid1.DataSource = AutoNumberedTable(datatable);
  12. }
  13. catch (Exception ex)
  14. {
  15. MessageBox.Show(ex.Message);
  16. }
  17. finally
  18. {
  19. dbclass.con.Close();
  20. }
  21. }

comments powered by Disqus