I know that is this question has dozen of answers and posts, but nothing works for me.
We have my MVC4 application and i deployed it to IIS7 to my server and one more machine where we don't have visual studio installed.
We are doing import/export data from/to excel for doing bulk entry.
we do have data around 20000 in one sheet with .xlsx format of Office 2007(File is save as Excel Work book).
Now when i read data by using following code it just read data around 4000-5000 rows only.
This whole below code
working fine in my local machine where i do code and read all 20000 rows data from "Excel 97-2003 Workbook with .xls"
but not working with "Excel Workbook with .xlsx".
private void FillDataSet(HttpPostedFileBase file, DataSet ds)
{
using (
var con =
new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" File Path";Extended Properties=Excel 12.0"))
{
con.Open();
var dtSchema = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
var strSheetName = "";
strSheetName = dtSchema.Rows[0]["TABLE_NAME"].ToString();
var cmd = new OleDbCommand();
var da = new OleDbDataAdapter();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT * FROM [" + strSheetName + "]";
da = new OleDbDataAdapter(cmd);
da.Fill(ds);
}
}
I have gone through the below steps and solutions but it's not working for me.
-Installing Microsoft Access Database Engine 2010 Redistributable
-Installing 2007 Office System Driver: Data Connectivity Components
we are confuse why it is working on my local machine and not working on server.
Please provide any idea or solution for this issue..
What I have tried:
I've tried this:
-From the solution explorer right-click your project then click Properties
-Click the Build tab
-Change Platform target from: Any CPU to x86 | Any CPU to x64
-Re-build your solution
-Also made changes on IIS in Advance setting with Enable 32-Bit application as True/False.