[quoted text, click to view] "Bart Mermuys" <bmermuys.nospam@hotmail.com> wrote:
> I'm not sure why it wouldn't work if eg. you used a DataView with a
> RowFilter set to show only one foreign key.
Well it turns out that had been part of the problem. I was NOT
explicitly setting a rowfilter for the manifest_id criterion because the
SELECT query I used to originally generate the datatable had a WHERE
clause for this already, so early-on it never occurred to me to set a
dataview RowFilter for this condition, too.
I was using a RowFilter, but for other conditions. This turned out to
ding me, as well, because when I clued-in that I needed such a filter for
the manifest_id foreign key, I just stuck it in there, forgetting about
my subroutine that constantly is resetting that filter based on those
other conditions. So my foreign key RowFilter would just get wiped out
by my standard filter-setting routine that I'd forgotten about and I'd go
on thinking this RowFilter idea wasn't working. This is getting
embarassing...
The long and the short of it is that I've incorporated the additional
foreign key criterion into the standard filter-setting sub, now, and it
works great.
[quoted text, click to view] > But there isn't any reason why the DataRow should disappear, which is
> probely more what you want. There are two things you can do:
>
> 1) After the Update, enumerate all rows and remove
> (dataTable.Rows.Remove) the rows whose foreign key has changed (since
> the last fill)
The problem with this would have been that I don't want to actually
DELETE the rows. I just want to zero-out their foreign key. If I do a
Rows().Remove, assuming I had a functioning DeleteCommand in place,
wouldn't this kill off the row?
[quoted text, click to view] > 2) After the Update, clear the DataTable/DataSet and re-fill, but
> before re-assigning it, try to set the DataSource to null first:
> dataGrid.DataSource = null;
> dataGrid.DataSource = someDataSource;
I tried this, too, and it didn't work. Strange, really, I always thought
that re-doing the FILL command would re-fill the underlying DataTable and
my view would reflect this new table, and in fact it seemed that the
records WERE disappearing from the view. However, the grid was still
showing them there. The only way to really get it to refresh seemed to
be to re-run the queries entirely. That meant doing a CLEAR on each of
the datatables in the dataset, then re-querying and re-attaching to the
grid.
Thanks, Bart, for your help with this.
--