Data truncated after 255 bytes while using Microsoft.Ace.Oledb.12.0 provider

前端 未结 5 759
抹茶落季
抹茶落季 2021-01-21 04:43

I am reading an excel sheet using the ACE provider and certain cells contain data greater than 255 bytes. I tried changing the TypeGuessRows in the registry settings as well as

相关标签:
5条回答
  • 2021-01-21 05:12

    I am also using Microsoft.ACE.OLEDB.12.0 on 64-bit Windows 7.

    I found that the TypeGuessRows in the connection string has no effect.

    But increasing the TypeGuessRows in the following registry location works:

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\12.0\Access Connectivity Engine\Engines\Excel

    More info on a similar bug (although you may already know this as you're already trying to change TypeGuessRows)

    0 讨论(0)
  • 2021-01-21 05:22

    The problem is that the ACE driver is inferring a TEXT data type for the column you're populating the data set from. Text columns are limited to 255 characters. You need to force it to use the MEMO data type.

    Your best bet for that is to garantee that the majority of the first eight rows in that column exceed 255 characters in length.

    Source

    This behavior is determined by the the predictive nature of the Excel driver/provider. Since it doesn't know what the data types are, it has to make a guess based upon the data in the first several rows. If the contents of a field exceeds 255 characters, and it's in the first several rows, then the data type will be Memo, otherwise it will probably be Text (which will result in the truncation).

    0 讨论(0)
  • 2021-01-21 05:35

    The solution to this was extremely simple. Just change the format of the column containing this huge data to "Text" from "General" in the excel sheet.

    Now I feel like a n00b.

    0 讨论(0)
  • 2021-01-21 05:35

    refer this link. I think this is the problem (try with Memo fields)

    http://allenbrowne.com/ser-63.html

    In Access tables, Text fields are limited to 255 characters,but Memo fields can handle 64,000 characters (about 8 pages of single-spaced text)

    Nice workaround: have a look at this stack answer

    0 讨论(0)
  • 2021-01-21 05:36

    Excel has some limits.

    Excel specifications and limits - 2013

    As you can see in the link posted:

    Feature Maximum Limit Column width 255 characters

    0 讨论(0)
提交回复
热议问题