string filelocation1 = @"D:\Alex\Arab_Test_1.xls"; string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filelocation + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\""; //create connection OleDbConnection oleDBConnection = new OleDbConnection(connectionString); oleDBConnection.Open(); //create the adapter with the select to get OleDbDataAdapter adapter = new OleDbDataAdapter("select * from [Sheet1$]", oleDBConnection); // Create the dataset and fill it by using the adapter. DataTable dataTable = new DataTable(); adapter.FillSchema(dataTable, SchemaType.Source); adapter.Fill(dataTable); DataSet ds=new DataSet(); ds.Tables.Add(dataTable); for (int rowNo = 0; rowNo < ds.Tables[0].Rows.Count; rowNo++) { for (int colNo = 0; colNo < ds.Tables[0].Columns.Count; colNo++) { newCERecord[rowNo] = ds.Tables[0].Rows[rowNo][colNo].ToString(); } //iRow++; } // Call update on the adapter to save all the changes to the dataset adapter.Update(dataTable);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)