(playerListTableAdapter.GetHeight(sortedPlayers[counter])
"Sorted Players" is an array of decimals, which match primary keys.
When I call the query GetHeight, I get the following error: "ConstraintException was unhandled: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."
The SQL statement for the query is:
SELECT Height
FROM PlayerList
WHERE (Number = @PlayerID)
Note: In the database, Number is a primary key.
When we step through the execution, we can see that sortedPlayers[counter] does match a player in the database.
Any ideas on what causes this error?
Thanks!
-Dominique
After fighting to get the query working, I discovered that I could access the value more directly by using the following syntax:
This allowed me to go pull the value from the database without using the tableAdapter query and is significantly simpler.
Incidentally, I did attempt to set the EnforceConstraints property of my tableAdapter to false, but it still threw the error.
Thank You for your help!