本文介绍了Sql Server CE 3.5 和 Visual Studio 中 ntext 的大小限制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 SQL Server CE 3.5 SP2 时遇到了一些奇怪的行为.

I am experiencing some strange behavior with SQL Server CE 3.5 SP2.

我有一个有 2 列的表格;一种名为 ID 的 int 类型,它是主键,一种名为值"的 ntext 类型.'Value' 列应该包含相当长的字符串值.但是,当我尝试存储长度超过 4000 个字符的字符串时,该值会变成空字符串!

I have a table with 2 columns; one of type int named ID, which is the primary key, and one of type ntext named 'Value'. The 'Value' column is supposed to contain rather long string values. However, when I try to store a string that is longer than 4000 characters, the value turns into an empty string!

我正在使用 Visual Studio 2010 服务器资源管理器来执行此操作.

I am using the Visual Studio 2010 server explorer to do this.

这是怎么回事?我认为这 4000 个字符的限制是针对 nvarchar 的,而 ntext 有 2GB 的限制.我是忘记了什么,还是 SQL Server CE 的这些限制不同?MSDN对此不是很清楚.

What's going on? I thought this 4000 character limit was for nvarchar and that ntext had a 2GB limit. Am I forgetting something or are these limits different for SQL Server CE? MSDN is not very clear on this.

推荐答案

好吧,在尝试了很多东西并阅读了许多关于该主题的晦涩帖子后,结果证明根本不是 sql server CE 问题,而是一个Visual Studio 的问题.

Alright, after trying a lot of things and reading many obscure posts on the subject, it turned out to be not a sql server CE problem at all, but an issue with Visual Studio.

在选项->数据库工具->查询结果下有一个设置,指定从查询中检索的最大字符数.发生的事情是,在服务器资源管理器表编辑器中输入字符串后,它实际上被持久化在 SQL Server CE 中,但由于上述设置,visual studio 无法显示它.

There is a setting under Options->Database Tools->Query results, that specifies the maximum numbers of characters retrieved from a query. What happened was that after the string was entered in the Server Explorer table editor, it was actually persisted in SQL Server CE but visual studio could not display it due to the aforementioned setting.

这篇关于Sql Server CE 3.5 和 Visual Studio 中 ntext 的大小限制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 05:22