H
Hexman
Hello all,
Back again with more questions. I have a task at hand and I'm trying
to use a datarelation between two datatables.
Table1 = Trans
fields= date, product, dept, assignto, .....
04/01/06 Clamp 54 <blank>
04/01/06 Valve 55 <blank>
04/01/06 Body 54 <blank>
Table2 = Staff
fields= dept, person, .....
54 Alice
54 Tom
55 Bob
55 Mary
55 Robert
I've set up 2 datagrids with each of the tables attached, now I want
to relate the Trans table to the Staff table using the dept as the
related columns. Here's my code.
Dim data_relation As New DataRelation("Trans-Staff", _
ds.Tables("Trans").Columns("TRDept"), _
ds.Tables("Staff").Columns("STDept"))
ds.Relations.Add(data_relation)
When I go to execute, it fails on the ds.relations.add line and comes
up with this error.
---------------------------------
An unhandled exception of type 'System.ArgumentException' occurred in
system.data.dll
Additional information: These columns don't currently have unique
values.
---------------------------------
The objective is to show all Trans in grid 1, and as a row is
selected, show only the Staff for the department that is selected in
grid 1. From there, one row of the staff will be selected (being
assigned to that transaction). I then plan to update the Staff row
with some info and update the trans with the person assigned from the
Staff table and other information.
I'm sure this has been done before. Any full examples would be
appreciated, but right now I need to fix this datarelation problem.
Thanks,
Hexman
Back again with more questions. I have a task at hand and I'm trying
to use a datarelation between two datatables.
Table1 = Trans
fields= date, product, dept, assignto, .....
04/01/06 Clamp 54 <blank>
04/01/06 Valve 55 <blank>
04/01/06 Body 54 <blank>
Table2 = Staff
fields= dept, person, .....
54 Alice
54 Tom
55 Bob
55 Mary
55 Robert
I've set up 2 datagrids with each of the tables attached, now I want
to relate the Trans table to the Staff table using the dept as the
related columns. Here's my code.
Dim data_relation As New DataRelation("Trans-Staff", _
ds.Tables("Trans").Columns("TRDept"), _
ds.Tables("Staff").Columns("STDept"))
ds.Relations.Add(data_relation)
When I go to execute, it fails on the ds.relations.add line and comes
up with this error.
---------------------------------
An unhandled exception of type 'System.ArgumentException' occurred in
system.data.dll
Additional information: These columns don't currently have unique
values.
---------------------------------
The objective is to show all Trans in grid 1, and as a row is
selected, show only the Staff for the department that is selected in
grid 1. From there, one row of the staff will be selected (being
assigned to that transaction). I then plan to update the Staff row
with some info and update the trans with the person assigned from the
Staff table and other information.
I'm sure this has been done before. Any full examples would be
appreciated, but right now I need to fix this datarelation problem.
Thanks,
Hexman