ACE oleDb drivers unable to handle huge excel files

柔情痞子 提交于 2019-12-12 10:09:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!