PDA

View Full Version : bound datagrid/dataset not refreshing


pjoyce
04-02-2003, 10:01 AM
He's a stumper (for me at least) I've a data grid on my page bound to a strongly-typed dataset. The datagrid includes a delete function. Due to the nature of my app, I have do some checking and possibly do a cascading delete -- blah, blah, not important. Anyway, I noticed that the delete is not reflected in the datagrid. (the row still shows up after I call my delete function.)

I am forcing the page to re-query the DB after the delete, using a data adapter's Fill() method. I ran the process, stepped through the delete code, watched the transaction commit, queried the table in query analyzer and saw that there were, as I expected, two records in the table. I then stepped through the code which re-queries the database. The dataset (after the query, mind you) still had three records.

The only thing I can think is that SQL server is somehow caching the resultset, or else something in the data adapter is doing that. The data adapter lives on the page itself, I am not creating it in the codebehind.

peter.

pjoyce
04-02-2003, 10:19 AM
I hate people who reply to their own messages. In any case, creating a new sqlDataAdapter each time I query fixed the problem, so it seems that fellow was the culprit who was caching my results. Is there a way to force a sqlDataAdapter to actually run the query again rather than use cached results?

bruce
04-03-2003, 10:39 AM
Yes.

You can do something like the following

Dim ds as data.dataset

ds = cache("cached_ds")


[b]quote:Originally posted by pjoyce

I hate people who reply to their own messages. In any case, creating a new sqlDataAdapter each time I query fixed the problem, so it seems that fellow was the culprit who was caching my results. Is there a way to force a sqlDataAdapter to actually run the query again rather than use cached results?
</blockquote id="quote"></font id="quote">