Monday 21 May 2007

Datasets

"One or more rows contain values violating non-null, unique, or foreign-key constraints."

Very informative error, that. Thanks very much Microsoft.

This can happen for a number of reasons, but for me it was happening because within the datatable in my dataset, I had columns set with smaller sizes than the actual stored procedure fetched. Therefore, I was trying to fit three litres of water into a two litre bottle.

I fixed this by matching the data table's column sizes to match those within the database. Somebody else was experiencing similar problems but with a different solution on the Microsoft Forums.

No comments: