When I was doing something today, found a very strange problem, the database (SQL Server) in the field set the type is ntext, but the saved data is always very short, beginning to think that in a section of the program set a length limit, in the Set breakpoint tracking debugging found that passing data is normal, But the content saved after the storage operation is always very short, number of characters saved 16, the database set the field type ntext length is also 16, so think is not a database of bugs, in Query Analyzer write INSERT statements to test, the results found that the saved content is normal , so the problem must be in the program, and finally check that the parameter type specified when constructing the Parameter object SqlParameter of the SqlCommand command object is ntext and specifies a length of 16, as follows
sqlparameter[] parms = new sqlparameter[] {
New SqlParameter (TemplateID, SqlDbType.Int),
New SqlParameter ("@Content", sqldbtype.ntext,16)
};
The length of the limit to remove, and then a test, all OK, hehe, it seems that a lot of things are not very clear concept is very easy to cause trouble problems, I hope this lesson can give me later also encounter similar problems friends a little hint.