Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 16th, 2003, 01:29 PM
Authorized User
 
Join Date: Jun 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Refresh Recordset

I am haveing a problem with the below page. When I come from the first page "20AddNewME.asp" everything works fine. strQSMEID is set to the querstring value from the previous page. This value is used in the SQL to pull the correct RS and the fields are completed correctly. I am able to change the value for the Location field and hit submit. This will send it to 24ProcAddEdit.asp. This page will update the database and set a Session variable "SV24MEID" and then Respons.Redirect back to the page in question "22AddEditMEPM". The IF Else Then will determine which page it came from and set the strQSMEID variable correctly. When the page redirects, the value for location did not change. When I check the database the value for location has been changed correctly. If I click the submit button again, then I will see the correct value for location. For some reason when the page runs again after being redirected back to this page the recordset does not get re-run. Is there some way I can force this to happen. I tried using the recordset resync method but I am using IIS 4 so I guess that is not supported. If I hit the refresh button on the browser I get a a message that says " The page cannot be refreshed without resending the information. Click retry to resend the information." Is there a way to force this retry?
 Sorry for writing a novel.

Thanks
Dale

<%@ Language=VBScript %>




<BODY>
page 22 <BR>

<%
Dim oConn22, oRS22, strConnect, strQSMEID, SQL22

Set oConn22 = Server.CreateObject("ADODB.Connection")'Open Connection
oConn22.Open strConnect

'Begin HOW DID WE GET HERE
If InStr(Request.ServerVariables("HTTP_REFERER"), "22AddEditMEPM.asp") Then
     strQSMEID = Session("sv24MEID")
     Response.Write "You came from 24"
     Response.Write Session("sv24MEID")
ElseIf InStr(Request.ServerVariables("HTTP_REFERER"), "20AddNewME.asp") Then
      strQSMEID =Request.QueryString ("MEID")
      Response.Write "You came from 20"
ElseIF InStr(Request.ServerVariables("HTTP_REFERER"), "24ProcAddEdit.asp") Then
     strQSMEID = Session("sv24MEID")
     Response.Write "You came from 24"
Else
               Response.Write "Where did you come from?"
End If
'End HOW DID WE GET HERE

SQL22 = "SELECT tblEquipment.MEID, tblEquipment.Location, tblEquipment.Type, "
SQL22 = SQL22 & " tblEquipment.SerialNumber, tblEquipment.Model, tblEquipment.Specs, tblEquipment.MEDate"
SQL22 = SQL22 & " FROM tblEquipment WHERE (((tblEquipment.MEID)= " & strQSMEID & "));"

Set oRS22 = Server.CreateObject ("ADODB.Recordset")
oRS22.Open SQL22, oConn22

oRS22.Resync
oRS22.MoveFirst
%>

<Form Action=24ProcAddEdit.asp Method=post Name=22AddEditMEPM>
<BR>
MEID &nbsp <Input Type="Text" Name="MEID" Value=" <%Response.Write oRS22("MEID")%>"><BR>
Location &nbsp <Input Type="Text" Name="Location" Value=" <%Response.Write oRS22("Location")%>"><BR>
Type &nbsp <Input Type="Text" Name="Type" Value=" <%Response.Write oRS22("Type")%>"><BR>
Serial Number &nbsp <Input Type="Text" Name="SerialNumber" Value=" <%Response.Write oRS22("SerialNumber")%>"><BR>
Model &nbsp <Input Type="Text" Name="Model" Value=" <%Response.Write oRS22("Model")%>"><BR>
Specs &nbsp <Input Type="Text" Name="Specs" Value=" <%Response.Write oRS22("Specs")%>"><BR>
Date MEID was entered &nbsp <Input Type="Text" Name="MEDate" Value=" <%Response.Write oRS22("MEDate")%>"><BR>
<input type=submit value=Submit id=submit1 name=submit1>"
</Form>

</BODY>
</HTML>
 
Old June 16th, 2003, 11:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I do not think this has anything to do with the "recordset resynching". The ADO objects are completely destroyed when the page has finished processing.

Instead, I think the browser is loading a cached version of the page, rather than getting a new, updated, copy from the server. I suggest you set the appropriate HTTP headers to tell the browser that the page should be either (a) not cached -or- (b) expired immediately, to force the browser to get a new copy each time from the server, rather than reloading the local copy:

Code:
<%
Sub SetHTTPHeaders( _
)

   Response.ExpiresAbsolute = #1/1/1980#
   Response.AddHeader "pragma", "no-cache"
   Response.AddHeader "cache-control", "private, no-cache, must-revalidate"

End Sub
and then call this sub in your code:

<%@Language=VBScript%>
<%
Option Explicit
%>

<%
Call SetHeaders()

' Other code here
%>

Cheers
Ken

www.adOpenStatic.com
 
Old June 17th, 2003, 02:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

Maybe Session variable sv24MEID has not a value you expect. You can check this value after the redirection you performed. It seems that session variable contains old value...

...but the Soon is eclipsed by the Moon
 
Old June 17th, 2003, 12:22 PM
Authorized User
 
Join Date: Jun 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a million. This one stumped me. I had looked at all of those response dots but never put them together and tried them.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Refresh GridView Using Refresh Button msbsam ASP.NET 2.0 Professional 0 December 6th, 2006 05:57 AM
ADODB.Recordset (0x800A0CB3)Current Recordset does tks_muthu Classic ASP Databases 0 June 16th, 2005 07:22 AM
Can I use SetInterval to refresh recordset? pigtail Javascript 4 April 10th, 2004 11:09 PM
Can I use setInterval to refresh recordset?? pigtail Javascript How-To 1 April 10th, 2004 08:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.