private void GetDetils(string sheet) { if (String.IsNullOrEmpty(FileName)) { throw new Exception("Select file"); } GridControl2.BeginUpdate(); GridControl2.DataSource = null; GridView2.Columns.Clear(); OleDbConnection connExcel = new OleDbConnection(); OleDbCommand cmdExcel = new OleDbCommand(); OleDbDataAdapter oda = new OleDbDataAdapter(); System.Data.DataSet ds = new System.Data.DataSet(); connExcel = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + FileName + ";Extended Properties=Excel 12.0;"); oda = new System.Data.OleDb.OleDbDataAdapter("select * FROM [" + sheet + "]", connExcel); oda.TableMappings.Add("Table", "Excel Data"); oda.Fill(ds); connExcel.Close(); GridControl2.DataSource = ds.Tables[0]; GridView2.ClearSelection(); GridControl2.EndUpdate(); }
private void ResetAllGrids() { ResetResultGrid(); GridControl2.BeginUpdate(); GridControl2.DataSource = null; GridView2.Columns.Clear(); GridControl2.EndUpdate(); }