HI,
I am using VS 2012, C#, ASP.NET.
I am trying to convert an Excel to datatable using the oledb connection.
But not all the rows are getting copied. Below is the code used:
string[] workSheetNames = new string[] { }; //List of Worksheet names
System.Data.DataTable dtExcelData = new System.Data.DataTable();
string SourceConstr = string.Empty;
if (strExtension == ".xls")
{
SourceConstr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + ExcelPath + "';Extended Properties= 'Excel 8.0;HDR=Yes;IMEX=1'";
}
if (strExtension == ".xlsx")
{
SourceConstr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + ExcelPath + "';Extended Properties= 'Excel 12.0;HDR=Yes;IMEX=1'";
}
using (OleDbConnection Con ...
Go to the complete details ...