2

我正在尝试通过 .NET (C#) 读取 excel 电子表格

下面是我使用的连接字符串:

Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Windows\TEMP\96e7a8b720b642388d9dbbca49537678.xls; Extended Properties="Excel 8.0;HDR=Yes;IMEX=1;TypeGuessRows=0;ImportMixedTypes=Text";

当我使用以下方法查看架构时:

using (var conn = new OleDbConnection(connStr))
        {
            conn.Open();
            result[OleDbSchemaGuid.Tables] = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
            result[OleDbSchemaGuid.Columns] = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, null);
            result[OleDbSchemaGuid.Tables_Info] = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables_Info, null);
            conn.Close();
        }

In result[OleDbSchemaGuid.Columns]- 所有列名都被截断为前 64 个字符。

我需要所有列的全名。

任何想法解决/解决这个问题?

非常感谢您查看此问题。

4

1 回答 1

0

Tim is right, as per this discussion on MSDN. you need to use some third party data access provider as this is the limit for Jet.

EDIT:

It can be done without using any third party provider as well. I read this Today on Microsoft's Support Site. According to them its limitation of Jet 4.0LEDB Source.

于 2012-08-24T05:59:01.650 回答