A: 

I'd suggest specifying the length of the field when creating the parameter:

var paramData = command.Parameters.Add("@StorageData", System.Data.SqlDbType.NText, /* column length here */);
paramData.Value = content;
Rowland Shaw
No it still throwing the exception. I used content.Length as the size.
Anindya Chatterjee
Thanks for your reply. Let me tell you one thing that I am going to create a desktop mail storage. Still I am not sure how to store the messages in an elegant way. This was my first try to store the content of the message in sqlce db. Is there any other better way to do this?
Anindya Chatterjee
It's advisable to add all the parameters in this manner, and specify the lengths as the column sizes in the actual database - this may make it easier to spot in the debugger as well, as you could compare the actual string.Length vs. what the database is defined as.
Rowland Shaw
+2  A: 

Maybe you should think about why do you have to put such large amounts of text into a database. Maybe a reference (link - path) to an external file would be a better solution.

Holli
Why I went for this is because I am creating a desktop mail storage, so creating files for each message would be really tedious, isn't it?
Anindya Chatterjee
A: 

Hi,

I if you can change the type of StorageData from ntext to image and write your content as Binary. I guess that would help you.

Cheers AK

Gohlool
+1  A: 

Have you read the docs for ntext data type?

Variable-length Unicode data with a maximum length of 230 - 1 (1,073,741,823) characters. Storage size, in bytes, is two times the number of characters entered

Is your very large content greater in size than the maximum? If so you're out of luck - you need a data type which can store more data than ntext. My suggestion: varbinary(MAX) or Image.

Jamiec