asp.net - 该字段太小,无法接受您尝试添加的数据量

标签 asp.net database oledb

这很奇怪,因为我没有插入数据,而是通过查询提取数据。

我在努力奔跑

SELECT DISTINCT description FROM products;

输出错误“字段太小,无法接受您尝试添加的数据量。”。

但是,运行以下命令不会产生错误:

SELECT description FROM products;

所以我对问题是什么感到困惑。

我正在使用 OleDbDataReader 并从 mdb 数据库文件中提取数据。

最佳答案

这可能与:http://support.microsoft.com/kb/896950/us 有关

This problem occurs because when you set the UniqueValues query property to Yes, a DISTINCT keyword is added to the resulting SQL statement. The DISTINCT keyword directs Access to perform a comparison between records. When Access performs a comparison between two Memo fields, Access treats the fields as Text fields that have a 255-character limit. Sometimes Memo field data that is larger than 255 characters will generate the error message that is mentioned in the "Symptoms" section. Sometimes only 255 characters are returned from the Memo field.

解决方法:

To work around this problem, modify the original query by removing the Memo field. Then, create a second query that is based on both the table and the original query. This new query uses all the fields from the original query, and this new query uses the Memo field from the table. When you run the second query, the first query runs. Then, this data is used to run the second query. This behavior returns the Memo field data based on the returned data of the first query.

关于asp.net - 该字段太小,无法接受您尝试添加的数据量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6454660/

相关文章:

c# - 创建一个json格式的对象

android - 拦截数据库错误 "file is encrypted or is not a database"

asp.net - 带有 Facebook 访问 token 的 MVC 5 Web API 到 RegisterExternal,无需 Cookie

java - 如何获取微调器上所选项目的 ID?

android - 如何根据日期和时间android每半小时重置一次计数?

vb.net - OLEDB 将 CSV 导入 VB.NET 数据表,将 '-' 读取为 0

c# - Access 数据库: Operation must use an updateable query

c# - 获取系统上安装的所有 Access ACE.OLEDB 驱动程序的列表

c# - 当应用程序池仍在运行时,是否可以/将终止长时间运行的线程

c# - 将焦点设置在文本框上会导致 CSS 溢出