当我尝试将新对象添加到本地数据库时,我进行了以下通信:
The table definition or the row size exceeds the maximum row size of 8060 bytes.
我的表具有以下结构:
[Table]
public class SomeClass
{
[Column(IsPrimaryKey = true, IsDbGenerated = true, CanBeNull = false, AutoSync = AutoSync.OnInsert)]
public int Id { get; set; }
[Column]
public string String1 { get; set; }
[Column]
public string String2 { get; set; }
[Column]
public string String3 { get; set; }
[Column]
public string String4 { get; set; }
}
其中 3 个字符串(String2、String3、String4)将包含 2000-3000 个字符。 当我尝试写入较小的数据(1000 到 1500 个字符之间)时,一切正常。
我该如何解决这个问题?
最佳答案
SQL Server 将记录存储在页中,页为 8k,因此记录不能超过该大小(与 8k 的差异是管理日期)。
您需要将文本列定义更改为 text
、ntext
或 varchar(max)
、nvarchar(max)
来存储较长的文本。这些 blob 列不受页面大小的限制。
关于linq - 将对象写入表时超过 8060 字节 - Windows Phone 7.5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12873966/