Link to home
Start Free TrialLog in
Avatar of jnsimex
jnsimex

asked on

Failed to enable constraints in Strongly Typed Dataset table

Hi Experts,

I created a program in VS 2008 which is used to process orders and I would like speed up this order entry process by having the users import the orders directly to the database. Once it is imported, they can open the order in the program and post it like they usually do when it is manually entered.

For orders that are imported, I am getting the "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints". I get this error when I am trying to fill a strongly typed Orderheader datatable during the posting procedure. When the order is created manually, I have no issue filling this table. I checked all the fields in the DB and the fields for the imported orders match the fields for orders that manually entered so I am not sure what is causing the error.

Can someone point me in the right direction to resolve this issue?
ASKER CERTIFIED SOLUTION
Avatar of sarabande
sarabande
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you are able to script the schema of your table you'll see which columns are not nullable and which ones has other constraints.
If you are doing your Dev/testing environment, Enable the SQL DB profiler and check what SQL Script/values are coming in when you import. This will help you to analyse further.

OrderHeader has a relation to another table like order/something like that ? then you should create order first before creating OrderHeader
Avatar of jnsimex
jnsimex

ASKER

Thank you so much for your reply. There was a trailing space in the imported key value causing the constraint error.