string strNewPath = Server.MapPath("~/UploadExcel/" + "Action Center_Agent.xls"); string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strNewPath + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\""; // Create the connection object OleDbConnection oledbConn = new OleDbConnection(connString); try { oledbConn.Open(); OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Agent$A9:Z500]", oledbConn); OleDbDataAdapter oleda = new OleDbDataAdapter(); oleda.SelectCommand = cmd; DataSet ds = new DataSet(); oleda.Fill(ds, "Customer"); DataTable dtExcel = new DataTable(); dtExcel = ds.Tables[0]; } catch { } finally { oledbConn.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)