bound datagrid/dataset not refreshing

Discussion in 'ASP.NET / ASP.NET Core' started by pjoyce, Apr 2, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. 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.
     
  2. 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?
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    Yes.

    You can do something like the following

    Dim ds as data.dataset

    ds = cache("cached_ds")


    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">
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page