da_cobra
August 24th, 2007, 01:47 PM
Hi again,
I just added a new table to my sql database with a relationship of '1 to many' , but when I execute my application I get this error :
"System.Data.ConstraintException was unhandled
Message="Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."
So now I have 2 tables :
tblCategories :
- IDCategory = relation 1 to
- CategoryName
- ...
tblMachines :
- IDMachine
- MachineName
- ...
- IDCategory many
(1 category per machine but many machines under a category, right?)
I know I didn't handled an exception, but why did this exception occured?
Since my English is not so very good, can someone explain what a constraint is? and why I get this error on this line :
tblCategoriesTableAdapter.Fill(machinepark_NVVetex_DataSet.tblCategories) ;
thx in advance
I just added a new table to my sql database with a relationship of '1 to many' , but when I execute my application I get this error :
"System.Data.ConstraintException was unhandled
Message="Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."
So now I have 2 tables :
tblCategories :
- IDCategory = relation 1 to
- CategoryName
- ...
tblMachines :
- IDMachine
- MachineName
- ...
- IDCategory many
(1 category per machine but many machines under a category, right?)
I know I didn't handled an exception, but why did this exception occured?
Since my English is not so very good, can someone explain what a constraint is? and why I get this error on this line :
tblCategoriesTableAdapter.Fill(machinepark_NVVetex_DataSet.tblCategories) ;
thx in advance