"Will truncate string or binary data." The statement was terminated. "Error

Source: Internet
Author: User
When you test your program, "the string or binary data will be truncated." The statement was terminated. "Such a mistake, think, should not ah, with a parameterized query, SqlParameter initialization has limited character length, after debugging found that the original C # SqlParameter initialization when the length of characters and SQL Server database length is not the same definition, For example, when we spell the SQL statement, we define the SqlParameter parameter, the length is the new SqlParameter ("@ parameter name", sqldbtype.varchar,50), and the corresponding field in the database is also VarChar (50), But we insert characters into the database can only insert 25 characters or 50 characters, and in the program regardless of character or Chinese characters are counted as a, so when we enter more than 25 Chinese characters, the execution of the INSERT statement, will be called "will truncate string or binary data." The statement was terminated. "Such a mistake.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.