Ordinary when you create a parent-child relationship between DataTables in a DataSet – there is a requirement that all values of the parent columns need to be unique. If they’re not – you will get an error: “These columns don’t currently have unique values“.
But there’re times when you need to make the relationship work even if those values are not unique. The solution is not to create constrain when creating the relationship. This can be done for example by passing FALSE as value for createConstrains parameter of Dataset.Relations.Add method:
oMyDataSet.Relations.Add("MyRel", _ oMyDataSet.Tables("TheParent").Columns("ParentColumn"), _ dtSet.Tables("TheChild").Columns("ChildColumn"), _ False)
Hi Yuri,
Thank you very much for this solution.
Thanks! you saved my weekend
I say thank you for you because you had shared this solutions.
🙂
WOW. 🙂 Super thank you to you dude 🙂
Thank’s from CUBA my friend Yuriy.
Amazing Yuriy. Thanx!
Idol na talga kita.. The best ka..You save my day.
Thank you very much ………
i need avoid datagridview duplicate row pls give some suggestion for that
@ravi I suggest eliminate duplicates at the source before you bind data to the grid. E.g. if you’re running a SELECT statement – do a SELECT DISINCT – this is oversimplification, but that’s the idea – eliminate duplicates before they hit the grid.
Thanx a lot dear
Thanks a lot dear
Thanks a lot sir
thanks buddy.