D
DJM
I have a dataset that includes a data table, Item, that has a LocationID
field on it. In the stored procedure I use to generate this dataset, I
include a Join on my Location table so that the Item table includes fields
like LocationName, LocationType, LocationSize, etc. for ease of display (I'm
binding to a data grid and want these location fields to be displayed
in-line with the Item row).
Now, the user has an opportunity to change the LocationID of the item row.
When that ID is changed, I want the other fields to update automatically. I
wrote some code that takes the updated LocationID and, first, searches the
rest of the table for an Item row with that LocationID (so I can get the
other fields from there instead of round-tripping to the database), or goes
to the database if no matching LocationID can be found. (The Location table
is huge; loading the entire thing into memory is not desirable.)
The problem is, I cannot change the other columns in a RowChanging event. I
can't use a RowChanged event, because then I cannot tell if a row has
changed because of the LocationID column. (It would also adversely affect
my attempt to scan the table for matching LocationIDs, since I'm looking for
a matching Current value, and the affected row itself's Current value is the
new LocationID.)
At least, this is how I understand my situation now. What can I do?
field on it. In the stored procedure I use to generate this dataset, I
include a Join on my Location table so that the Item table includes fields
like LocationName, LocationType, LocationSize, etc. for ease of display (I'm
binding to a data grid and want these location fields to be displayed
in-line with the Item row).
Now, the user has an opportunity to change the LocationID of the item row.
When that ID is changed, I want the other fields to update automatically. I
wrote some code that takes the updated LocationID and, first, searches the
rest of the table for an Item row with that LocationID (so I can get the
other fields from there instead of round-tripping to the database), or goes
to the database if no matching LocationID can be found. (The Location table
is huge; loading the entire thing into memory is not desirable.)
The problem is, I cannot change the other columns in a RowChanging event. I
can't use a RowChanged event, because then I cannot tell if a row has
changed because of the LocationID column. (It would also adversely affect
my attempt to scan the table for matching LocationIDs, since I'm looking for
a matching Current value, and the affected row itself's Current value is the
new LocationID.)
At least, this is how I understand my situation now. What can I do?