0
我有一個WPF應用程序,當我運行選擇,我得到一個錯誤,不同的查詢作爲問題使用select distinct在WPF
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
的.cs代碼:
Saman.DatabaseDataSet databaseDataSet = ((Saman.DatabaseDataSet)(this.FindResource("databaseDataSet")));
// Load data into the table Employee. You can modify this code as needed.
Saman.DatabaseDataSetTableAdapters.PartsTableAdapter databaseDataSetPartsTableAdapter = new Saman.DatabaseDataSetTableAdapters.PartsTableAdapter();
databaseDataSetPartsTableAdapter.FillBy(databaseDataSet.Parts);
System.Windows.Data.CollectionViewSource partsViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("partsViewSource")));
partsViewSource.View.MoveCurrentToFirst();
和查詢
Select DISTINCT Category from Parts
看看這裏,也許它會幫助擺脫你的問題:http://stackoverflow.com/questions/7026566/failed-to-enable-constraints-one - 或更多 - 行 - 含有值違規,非空 – michele