Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8890893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:36:19+00:00 2026-06-14T22:36:19+00:00

My project in C# Winforms 2010 and use SQL Server express and Linq-to-SQL. My

  • 0

My project in C# Winforms 2010 and use SQL Server express and Linq-to-SQL. My project get me exception:

The INSERT statement conflicted with the CHECK constraint “CK_BarCode_Num”. The conflict occurred in database “Parking”, table “dbo.TBL_Cards”, column ‘BarCode_Num’

and when I ran this query:

SELECT name, definition
FROM sys.check_constraints
WHERE name = 'CK_BarCode_Num'"

the output shows the definition of:

Name: CK_BarCode_Num    
Definition: (datalength([BarCode_Num])=(13))"

but in TBL_Cards in database, type of BarCode_Num is varchar(100) and in code behind, I declare int for type of BarCode_Num.

I don’t know where is set datalength([BarCode_Num])=(13)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:36:21+00:00Added an answer on June 14, 2026 at 10:36 pm

    The check constraint is saying that whatever you insert into Barcode_Num has to be exactly 13 characters long.

    If you’re trying to insert something that isn’t 13 characters long, I’d recommend you consult the documentation for your database (or talk to whoever set it up) to understand why this constraint has been applied.

    We’ll not be able to answer that for you, and I wouldn’t recommend altering the check constraint without understanding why it exists in the first place.


    DATALENGTH

    Returns the number of bytes used to represent any expression.

    For varchar, the number of bytes used corresponds 1-1 with the number of characters. For nvarchar you would need to divide by 2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a WinForms project that requires SQL Server 2008 R2 Express. The application
I've built a Visual Studio (2010) Installer Setup project to deploy a basic WinForms
I made a project in Visual Studio 2010 (winforms). I made a new Form
I am trying to build a C project in Visual C++ 2010 Express as
I am trying to build a C project in Visual C++ 2010 Express as
All, I'm using MSVS 2010 doing a project with C#/WinForms. I made an object
Having a problem with this Winforms project. Trying to use the SelectedIndexChanged event on
a few days ago, I developed a WinForms application in C# using VC#2010 Express.
If I make a Visual Studio 2010 WinForms project and let the wizard add
I have this WinForms project (based on this one , but modified for SharePoint

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.