1
votes

I am reading excel using oledb provider with following connection string:

"Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=Excel 12.0 XML;Data Source=FileName.xlsx;"

and then I am just reading records by "select * from ......." into data reader.

With above connection string and code I am able to read all (small,large with almost 45000 records) excels in development mode i.e. in debug mode.

But when I publish same code in IIS then only 27043 rows are getting read, not all rows. (Issue seems with filesize not with no.of records)

I checked at other question at stackoverflow which has answer to change IMEX value to 1 but this change not helping me.

All the code working fine in debug mode so I wonder why its not working after publish??

If any of you have faced such issue, please assist.

Thanks.

1
You do know that Excel is about the worst possible data store option for a web site, right? Even flat files and Access are better.Joel Coehoorn
true, but the functionality is client will upload the excel and I need to read and validate it row by row and then store the data to the database.user2809474
How did you solve it?levi

1 Answers

1
votes

add in web.config below code that might be helpful .....

<system.web>  
    <httpRuntime maxRequestLength="1048576"  executionTimeout="90000"/> 
  </system.web>

<system.webServer>   
  <security>
    <requestFiltering>
       <requestLimits maxAllowedContentLength="2147483648"/>
    </requestFiltering>
  </security>
    <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>