问题
Does ACE OLEDB drivers have any known issues with larger files? I am using the below code to retrieve the worksheets in a 400Mb xls file
public string[] GetWorkSheets()
{
var connectionString = "Provider=Microsoft.ACE.OleDb.12.0; data source=c:\filepath\filename.xls; Extended Properties=\"Excel 8.0;IMEX=1;HDR=YES;\"";
DataTable dataTable;
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
connection.Open();//Exception thrown here for large files
dataTable = connection.GetSchema("Tables");
}
int lenght = dataTable.Rows.Count;
string[] worksheets = new string[lenght];
for (int i = 0; i < lenght; i++)
{
worksheets[i] = dataTable.Rows[i]["TABLE_NAME"].ToString();
}
return worksheets;
}
I receive a OleDbException with the message System resource exceeded. I am not calling this function in loops, or opening any other connection before I reach here. This code works perfectly for smaller files.
My system has 4Gb RAM.Runs on Windows 7 64Bit. The Ace driver is also 64bit.
Any idea what can be done on fix this issue?
回答1:
You are using ACE so i assume it is a 32bit platflorm. Win2k3?
Have you tried it with the /3GB switch in boot.ini?
The virtual address space of processes and applications is still limited to 2 GB unless the /3GB switch is used in the Boot.ini file. http://www.microsoft.com/whdc/system/platform/server/pae/paemem.mspx
With /3GB you get one GB extra which might just do the trick?
回答2:
read this article
http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP010073849.aspx
maybe your file has more then 1,048,576 rows by 16,384 columns?
来源:https://stackoverflow.com/questions/4990158/ace-oledb-drivers-unable-to-handle-huge-excel-files