private void load_data() { SqlConnection con = new SqlConnection(dbclass.constring); try { string query = "SELECT * from tbl_customer "; SqlCommand cmd = new SqlCommand(query, con); SqlDataAdapter adp = new SqlDataAdapter(cmd); DataTable datatable = new DataTable(); adp.Fill(datatable); this.Grid1.DataSource = AutoNumberedTable(datatable); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { dbclass.con.Close(); } }