开发者

Correct way of storing custom text wrapped with styles - Database or Text File?

开发者 https://www.devze.com 2023-01-31 09:21 出处:网络
I am running ASP.NET connecting to a SQL Server 2005 database. Currently all my da开发者_C百科ta get\'s saved in the database but when I use my HTML editor control (to allow the user to add styles to

I am running ASP.NET connecting to a SQL Server 2005 database.

Currently all my da开发者_C百科ta get's saved in the database but when I use my HTML editor control (to allow the user to add styles to the text) sometimes I get the following error when I copy text with lots of styles from another website into the text area (error comes up when data is trying to save to database):

String or binary data would be truncated. The statement has been terminated.

Why is this and how do I handle this? Save the text rather to a text file?

The size of the field in the database is big enough!

Edits

INSERT INTO TableName(Name, Age, Comments) VALUES (@Name, @Age, @Comments)

Then from my code behind I simply call my SQLDatasource like so

SqlDataSource.Insert()


It sounds like you are passing a string variable to a stored procedure whit p.e. varchar(250) and the string length is over 251, even if the field in the table is varchar(1025) you'll get the error because of the param length is not ok.

Or... Try to use "text" type on db field?

It's an idea, if you get more info we'll be more usefull. :)

0

精彩评论

暂无评论...
验证码 换一张
取 消