2013-07-16 48 views
0

我有一個微軟訪問2010數據庫,其中我使用richtextbox將數據放入一行後,並且格式化了4個文本字我得到一個錯誤,說「該字段太小而無法接受數據你試圖量增加。嘗試插入或粘貼更少的數據」 我沒有設置表中的行255個字符,我只是將4個字c#訪問數據庫的數據量錯誤

+0

你向我們提供您的代碼嗎? - 用於插入數據的那個。所以我們可以幫助你。 – Marek

+0

[該字段太小而無法接受您嘗試添加的數據量。有沒有人從ADO.NET中得到這個錯誤?(http://stackoverflow.com/questions/5984312/the-field-is-too-small-to-accept-the-amount-of-data-you-attempted-對附加有安) – Ranco

回答

2

嘛,一個RichTextBox包含格式信息,所以它會返回比你在控件中看到的文本長得多。

例如,見下面的代碼:

Option Compare Database 
Option Explicit 

Private Sub Detail_Click() 
    MsgBox Me.RichTextBox0.Value 
End Sub 

Private Sub Form_Load() 
    Me.RichTextBox0.Value = "Only four words really!" 
End Sub 

這將返回:

{\rtf1\ansi\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}} 
{\*\generator Riched20 15.0.4481}{\*\mmathPr\mwrapIndent1440 }\viewkind4\uc1 
\pard\f0\fs17\lang1033 Only four words really! 
\par 
\par }