The followiing are that code that I have used to read excel file: DataSet myDataset = new DataSet(); if (!FullFileName.Equals("")){ OleDbConnection conn = new OleDbConnection(); OleDbCommand cmd = new OleDbCommand(); OleDbDataAdapter da = new OleDbDataAdapter(); string query = null; string connString = ""; string strFileType = System.IO.Path.GetExtension(FullFileName).ToString().ToLower(); if (strFileType.Trim() == ".xls"){ connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FullFileName + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\""; } else if (strFileType.Trim() == ".xlsx"){ connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FullFileName + ...
Comments
Post a Comment