2011-06-23 39 views
1

這很奇怪,因爲我沒有插入數據,我正在用查詢提取數據。該字段太小,無法接受您嘗試添加的數據量

我試圖運行

SELECT DISTINCT description FROM products; 

,輸出錯誤「字段是太小,無法接受數據的你試圖添加量。」

然而,運行以下不會產生錯誤:

SELECT description FROM products; 

所以我很困惑,什麼問題會。

我正在使用OleDbDataReader並從mdb數據庫文件中取出數據。

+1

這可能涉及到:http://support.microsoft.com/kb/896950/us –

+0

看起來像這就是問題所在。我必須做一個解決方法。謝謝您的幫助! – Marcin

回答

2

這可能涉及到: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.

+0

雖然我懶得使用該解決方法,但這是問題所在。相反,我只是選擇了該領域並使用散列表跟蹤重複項。 – Marcin

相關問題