private void fillGrid(String query, int i) { dc.openCon(); SqlDataAdapter da = dc.selectTable(query); DataTable dt = new DataTable(); da.Fill(dt); if (i == 1) { metroGrid1.DataSource = dt; DataGridViewButtonColumn col = new DataGridViewButtonColumn(); col.UseColumnTextForButtonValue = true; col.Text = "Delete"; col.Name = "deleteUsr"; metroGrid1.Columns.Add(col); dc.closeCon(); } else { metroGrid2.DataSource = dt; DataGridViewButtonColumn col = new DataGridViewButtonColumn(); col.UseColumnTextForButtonValue = true; col.Text = "Delete"; col.Name = "deleteUsr"; metroGrid2.Columns.Add(col); dc.closeCon(); } }
void dispTableLog(String query) { DataCon dc = new DataCon(); SqlDataAdapter da = dc.selectTable(query); DataTable dt = new DataTable(); da.Fill(dt); metroGrid2.DataSource = dt; }