Solved

Page doesn't load all recordsets. Need a ONE TIME page refresh on load...

Posted on 2009-04-03
6
547 Views
Last Modified: 2012-05-06
Experts, I'm back again... I have over 1300 lines of code and posting it is going to bore you half to death.  Here's the situation: I have a page that loads and not all the recordsets load the first time. I get an EOF or BOF error, "Sometimes".  Then you refresh the page and the error goes away.

Here's the error:
ADODB.Field error 800a0bcd

Either BOF or EOF is True, or the current record has been deleted.  Requested operation requires a current record.

/webproject/project-dashboard.asp, line 1330

The problem isn't EOF or BOF because when I refresh the page, there's no error.  It doesn't make sense. It happens only for some users and not others. I have totals that are coming in from the database and either I get the results from a previous project or all "0s" (Zeros).  Then I refresh the page and all the totals are there. Bizzar.

To me, it doesn't make any sense why on a refresh (reload) the page retrieves the data fine but on first load it doesn't.  I have the proper meta tags for PRAGMA No-Cache and the like so that's not the problem.

Trying a window.location.reload() firing this from the BODY ONLOAD event causes an infinite reloading loop. Not good.

So how do I cause a REFRESH ONLY ONCE when this page loads or am I looking at a bigger problem or something really simple?  If you really want the code, I'll paste it... but believe me, it's over 1300 lines.
0
Comment
Question by:pborregg
  • 2
  • 2
  • 2
6 Comments
 
LVL 10

Assisted Solution

by:MaxOvrdrv2
MaxOvrdrv2 earned 250 total points
Comment Utility
well, first off, this shouldn't be happening... if your SQL and your ASP is correct, there shouldn't be a page refresh issue. Unless you're using access and there are a ton of users hitting the DB at the same time. Otherwise, should be fine. An easy way is with the querystring object:

after you load all of the records, do this:

if Request.QueryString("loaded")=0 OR IsNull(Request.QueryString("loaded")) then
    Response.Redirect("yourpagename.asp?loaded=1")
end if

that should refresh only once.

M
0
 
LVL 10

Assisted Solution

by:MaxOvrdrv2
MaxOvrdrv2 earned 250 total points
Comment Utility
and if you are willing, i could look at your code for you... just upload it in .txt format... rename your .asp page to .txt and upload, and i'll check it... i've got nothing to do for a while so i'm up for it.

M
0
 
LVL 15

Accepted Solution

by:
fsze88 earned 250 total points
Comment Utility
like this?

 
 
 

<script language="javascript">

function setCookie(c_name,value,expiredays){

  var exdate=new Date();

  exdate.setDate(exdate.getDate()+expiredays);

  document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
 

}
 

function getCookie(c_name){

if (document.cookie.length>0)

  {

  c_start=document.cookie.indexOf(c_name + "=");

  if (c_start!=-1)

    {

    c_start=c_start + c_name.length+1;

    c_end=document.cookie.indexOf(";",c_start);

    if (c_end==-1) c_end=document.cookie.length;
 

    return unescape(document.cookie.substring(c_start,c_end));

    }

  }

return "";

}

</script>
 
 

<script type="text/javascript">

var reloaded = getCookie('reloaded');

if (reloaded == '' || reloaded == 'false'){

  setCookie('reloaded','true',1);

  document.write("needs reload");

//  setTimeout('window.location.reload()',2000);

  window.location.reload();

}else{

  setCookie('reloaded','false',1);

  document.write("reloaded");

}

</script>

Open in new window

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Closing Comment

by:pborregg
Comment Utility
You're all geniuses...

I have to rebuild the code you wrote.... MaxOvrdrv2 for JScript but it works nonetheless.

if(Request.QueryString("pid")=="" || Request.QueryString("pid")==null)
{
   Response.Redirect("project-dashboard.asp?pid=Session('SV_PID')");
}

fsze88 your code works too... I had to add them both and they're working in tandum. Brilliant!!!!
0
 

Author Comment

by:pborregg
Comment Utility
FSZE 88: can you explain your code above in Psuedo-Code so I can explain it to the NON-PROGRAMMERS please?

Thanks.

Peter
0
 
LVL 15

Expert Comment

by:fsze88
Comment Utility
Okey, sure!
It is reading cookie variables from each client. cookie means client browsers local variable, each browsers (ie, ff, safari, opera, chrome) having their own cookie variable.... e.g. you can store cookie at ie browser and read it as well, but it can't be read by another browser and so on of ff, safari, opera..
I have javascript function setCookie(c_name,value,expiredays) that store variable name, value, expireday. getCookie(c_name) return the value of variable of the name c_name....
at the beginning, there is no cookie on browsers so the first line
var reloaded = getCookie('reloaded');
it should be '',  set the variable named reloaded to be true and force it to be reload by window.location.reload();
after refreshed set the variable named reloaded to false and force it to be reload by window.location.reload(); in later on...
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now