I have two tables: A and B.
Table A:
Id | Number 1 | 2 2 | 5 3 | 1
Table B:
Id | Name 2 | X 5 | Y 1 | Z
When I get information from the database, I populate a DataSet. However, I use JOIN on A.Number = B.Name. So resulting in:
Result:
Id | Number | Name 1 | 2 | X 2 | 5 | Y 3 | 1 | Z
I have a DataGridView which displays the Result, but only Id and Name columns.
One thing bothers me. I would want to change Result.Name value in the DataGridView, but I want table A to be updated with respective A.Number value for the B.Name value. Table A doesn’t have Name column.
So I want to get things like this:
Table A before:
Id | Number 1 | 2
Number 2 accords to ‘X’ Name value.
Change Name in the DataGridView for ‘Y’ which accords to ‘5’ Number…
Table A after:
Id | Number 1 | 5
Don’t use a Join.
You want to show table A as the principal with a lookup column for Number.
You’ll need a Relation between A and B and an DataColumn with an Expression property on A