A situation in which data is automatically intercepted when the data operation is performed in the ASP.NET.

xiaoxiao2021-04-04  245

Today, when you do something, I found a very strange question. The type set of fields in the database (SQL Server) is NTEXT, but the saved data is always very short, and the start is to set the length restriction in a certain segment of the program. After breakpoint tracking debugging found that the data of the delivery is normal, but the content saved after the storage operation is performed is always very short, the number of characters saved is 16, and the length of the field type NTEXT set in the database is also For 16, then I want to be the database's bug, just write the INSERT statement in the query analyzer, and find that the preserved content is normal, so that the problem is sure to check in the program, and finally check the parameter object in constructing the SQLCommand command object SQLParameter The specified parameter type is nText and specifies its length of 16, and the writing is as follows.

Sqlparameter [] PARMS = New Sqlparameter [] {

New SqlParameter (TemplateID, SqldbType.It),

New Sqlparameter ("@ Content", SqldbType.nText, 16)

}

Remove the length of the length, then test, everything OK, huh, it seems that a lot of things is not very clear, it is easy to cause trouble, I hope this lesson can give me a similar problem with a similar problem.

转载请注明原文地址:https://www.9cbs.com/read-131855.html

New Post(0)