0

我有一个 WPF 应用程序,当我运行 Select distinct query 时出现错误

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
4

1 回答 1

0

我认为这可能与您的数据表有关,请检查您的 xsd 文件,尤其是 Parts TableAdapter

于 2012-10-03T14:45:02.757 回答