"These columns don't currently have unique values"

  • Thread starter Thread starter web1110
  • Start date Start date
W

web1110

Hi y'all,

I was playing with the NorthWind database, displaying subtables in a
DataGrid. It worked fine for 3 levels, but when I added a fourth, I got the
following error:

These columns don't currently have unique values

The initialization code below generates the error on the last statement
(dataSet1.Relations.Add(clDataRelation34)). The odd thing is, if I CONTINUE
past the error, the program runs and the nesting within the dataGrid seems
to be fine.

sqlDataAdapter1.Fill(dataSet1);
sqlDataAdapter2.Fill(dataSet1);
sqlDataAdapter3.Fill(dataSet1);
sqlDataAdapter4.Fill(dataSet1);
clDataColumn11=dataSet1.Tables["Customers"].Columns["CustomerID"];
clDataColumn12=dataSet1.Tables["Orders"].Columns["CustomerID"];
clDataRelation12=new System.Data.DataRelation("Customer_Orders",
clDataColumn11, clDataColumn12);
dataSet1.Relations.Add(clDataRelation12);
clDataColumn21=dataSet1.Tables["Orders"].Columns["OrderID"];
clDataColumn22=dataSet1.Tables["Order Details"].Columns["OrderID"];
clDataRelation23=new System.Data.DataRelation("Order_Details",
clDataColumn21, clDataColumn22);
dataSet1.Relations.Add(clDataRelation23);
clDataColumn31=dataSet1.Tables["Order Details"].Columns["ProductID"];
clDataColumn32=dataSet1.Tables["Products"].Columns["ProductID"];
clDataRelation34=new System.Data.DataRelation("Product_Details",
clDataColumn31, clDataColumn32);
dataSet1.Relations.Add(clDataRelation34);

Any ideas?

Thanx,
Bill
 
Back
Top