Re: Caching problems




Peter wrote:
Tomasz,
When you say "my code is not reading the db until I press F5", you have
another issue here besides caching. The code in the page should always run,
whether you have attempted to tell receiving browser whether to cache the
page or not.

Perhaps you would like to post a "short but complete" code sample showing
how your code makes the database call?

Hello,

This is my Page_Load function:

private void Page_Load(object sender, System.EventArgs e)
{
Response.Expires = -1;
Response.AppendHeader("Pragma", "no-cache");
Response.Cache.SetNoStore();
Response.Cache.SetCacheability(HttpCacheability.NoCache);

//Fill in Werker Liste
if ((!Page.IsPostBack) || (Request.QueryString["reload"] == "yes"))
{
LoadWorkers("");
}

//Fill in Abteilungen List
if (!Page.IsPostBack)
{
LoadDivisions();
}
}
I tried to remove Page.IsPostBack condition, but this is not working
too.

What is really important is LoadWorkers function:

private void LoadWorkers(string strDivision)
{
WerkerListe.Items.Clear();
DataSet DSWerker = new DataSet();
string WQuery = "SELECT * FROM Werker";
if (strDivision != "")
{
int AbteilungID = Int32.Parse(strDivision);
WQuery = WQuery + " WHERE AbteilungID=" + AbteilungID;
}

WQuery = WQuery + " ORDER BY Werkernachname ASC";

DSWerker = ADBEngine.GetDBData(WQuery, "Werker");
if ((DSWerker.Tables.Count > 0) & (DSWerker.Tables[0].Rows.Count >
0))
{
for (int i = 0; i < DSWerker.Tables[0].Rows.Count; i++)
{

object obj = DSWerker.Tables[0].Rows[i].ItemArray[1];
string werNach = (string)obj;
obj = DSWerker.Tables[0].Rows[i].ItemArray[2];
string werVor = (string)obj;
WerkerListe.Items.Add(werNach + " " + werVor);
obj = DSWerker.Tables[0].Rows[i].ItemArray[0];
int WID = (int)obj;
WerkerListe.Items[WerkerListe.Items.Count - 1].Value =
WID.ToString();
}
WerkerListe.SelectedIndex = 0;
}
}

ADBEngine is my class written only for this project to make reading
data from DB easier and more simple. This class is in moment maximally
simplified, and it is initialized in my webform class as follows:
protected AusbildungenEngine ADBEngine = new AusbildungenEngine();
constructor opens a database connection

What is really funny - i have on my page Label, which i use to debug
this code. So i put in LoadWorkers method few lines which are changing
text of this label to see if these lines are executed. So,
theoretically they where, but if i wanted to view f.e. current count of
rows of the table in DB then i got incorrect (old) count, so it looked
like it would be read from cache or something.

i hope i explained this enough clearly ;-)

Thanks in advance!

--
Tomasz

.



Relevant Pages

  • Re: section ref customization
    ... > On the second reading of the op, ... As each label causes defining a new macro while ... > {{name of endmarker}{page-number at endmarker}}. ...
    (comp.text.tex)
  • Re: Modifying Label Vertical Alignment
    ... Access file, and bring it back to work and have the forms display ... enough to specify a local path, so I could have the Access file opened ... reading the ... with the top on the right side of the label. ...
    (microsoft.public.access.forms)
  • Re: Kashrut alert -- another one already
    ... and where decisions have to be made by reading the ... >>> contents label. ... >> Thanks Eliyahu for the reminder of how fortunate we are. ...
    (soc.culture.jewish.moderated)
  • Re: bright
    ... just how do you know (other than by reading the ... > Mine has a tiny label next to the indicator light that says "PM". ... so long as the clock doesn't track the date, ... >> an alarm clock, of course.) ...
    (rec.puzzles)