Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) 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 October 18th, 2005, 11:50 AM
Authorized User
 
Join Date: Jan 2005
Location: Sao Paulo, SP, Brazil.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default Still the "Refresh problem" ...


Hello Everyone!

Let me explain a bit more the problem: I use two recordsets, each one related to a different Access query. The first one is used to populate a ("repeat region") table and the other gives just one value that is put in another table in the same page.

What happens? When the page is loaded, the repeat-region-table seems "blank" and the other single-value appears (correctly) or... the other way round (table populated, single-value missing)!

To "appear everything" I simply click the refresh button and then ok!

What I need? Some instructions to garantee that the WHOLE code will be processed before it appears in the browser, I guess!

Any help?

Thanks in advance,
fskilnik

P.S.: I did not include the ASP code but if you need it, I can create a small testing page to "show" the problem involved.



 
Old October 18th, 2005, 12:14 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yeah, please post some code.

At what stage do you load the Recordsets? Are they depending on values from the other recordsets? And what happens if you directly enter your query in Access? Do you get what you expect?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old October 18th, 2005, 01:20 PM
Authorized User
 
Join Date: Jan 2005
Location: Sao Paulo, SP, Brazil.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hi there, Imar!

Have you seen that I solved my last trouble using the links you suggested? :)


Thanks again!

YES, one of the recordsets depends on the other!! What do you suggest me to do then?

Thanks A LOT!

Regards,
fskilnik

 
Old October 18th, 2005, 02:11 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

No, I didn't. I saw your initial reply, but never saw that you edited the message. Glad it's working.

If one depends on the other, it's important they are opened in the right order. I suggest that you post the code so we can take a look.

What about the other questions from my previous post?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old October 18th, 2005, 03:53 PM
Authorized User
 
Join Date: Jan 2005
Location: Sao Paulo, SP, Brazil.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hello Imar,

> No, I didn't. I saw your initial reply, but never saw that you edited the message. Glad it's working.

  I edited that message today. If you have time, have a look! I adapted the code given there (and the comments/errata) to the format I wanted. The nice thing was that it was also related to the LCID´s that you taught me in a previous topic!!

> If one depends on the other, it's important they are opened in the right order. I suggest that you post the code so we can take a look.

 Well put. I simply didn´t check that. Anyway, I will do as I promised: because the code is too big (and includes templates and many irrelevant details to the matter) I will start creating a "small situation" similar to the one I have there (and with the same problem, for sure). As soon as I have it, I will post it here for you to have a look. Thanks!

> What about the other questions from my previous post?

 Sorry for them. Let me answer now:

> At what stage do you load the Recordsets?

  I don´t know if I understand your question, but it seems to me that you mean "what is the relative position between the loading of the recordsets and the other stuff present in the code?". If I am right, the answer would be "as soon as the page loads, right after the user logins (with password and session variable association related to his userID)" ...

> And what happens if you directly enter your query in Access? Do you get what you expect?

 Yes, I do! As a matter of fact, I really don´t thing the problem is query-related... I believe that the recordset stages or relative opening order between them is/are the problems involved.

Well, that´s all for now. Thank you very much for your assistance. I will write to you again today or, probably, tomorrow.

Best regards,
Fábio.






 
Old October 18th, 2005, 03:57 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Sure, no problem. Post whatever you have whenever you have it and I'll take a look. There is also a fair chance that by recreating a simple test case, you might discover a problem in your coding logic and have it fixed even before you post here again.... ;)

Good luck,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old October 18th, 2005, 06:25 PM
Authorized User
 
Join Date: Jan 2005
Location: Sao Paulo, SP, Brazil.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I´m back, Imar.

I did the "small situation" and, again, I had to "Refresh" the page to have all the fields properly extracted from the database.

The code follows. Thank you very much for your support!

Regards,
Fábio.

Another (small) doubt related to the code below: how can I do to put in the "rsWhoUser" recordset both the LoginLogged AND the PasswordLogged to search in my database for the correspondent UserID (to associate it with the UserIDLogged)? Thanks!

-------------------------------------------------------------------

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<%
Dim rsNumber1__MMColParam
rsNumber1__MMColParam = "1"
If (Session("userIDLogged") <> "") Then
rsNumber1__MMColParam = Session("userIDLogged")
End If
%>
<%
Dim rsNumber1
Dim rsNumber1_numRows

Set rsNumber1 = Server.CreateObject("ADODB.Recordset")
rsNumber1.ActiveConnection = MM_connDatabase_STRING
rsNumber1.Source = "SELECT * FROM qryPurchases WHERE userID = " + Replace(rsNumber1__MMColParam, "'", "''") + ""
rsNumber1.CursorType = 0
rsNumber1.CursorLocation = 2
rsNumber1.LockType = 1
rsNumber1.Open()

rsNumber1_numRows = 0
%>
<%
Dim rsNumber2__MMColParam
rsNumber2__MMColParam = "1"
If (Session("userIDLogged") <> "") Then
rsNumber2__MMColParam = Session("userIDLogged")
End If
%>
<%
Dim rsNumber2
Dim rsNumber2_numRows

Set rsNumber2 = Server.CreateObject("ADODB.Recordset")
rsNumber2.ActiveConnection = MM_connDatabase_STRING
rsNumber2.Source = "SELECT * FROM qryTotalPerInvestor WHERE userID = " + Replace(rsNumber2__MMColParam, "'", "''") + ""
rsNumber2.CursorType = 0
rsNumber2.CursorLocation = 2
rsNumber2.LockType = 1
rsNumber2.Open()

rsNumber2_numRows = 0
%>
<%
Dim rsWhoUser__MMColParam
rsWhoUser__MMColParam = "1"
If (Session("PasswordLogged") <> "") Then
rsWhoUser__MMColParam = Session("PasswordLogged")
End If
%>
<%
Dim rsWhoUser
Dim rsWhoUser_numRows

Set rsWhoUser = Server.CreateObject("ADODB.Recordset")
rsWhoUser.ActiveConnection = MM_connDatabase_STRING
rsWhoUser.Source = "SELECT userID, userLogin, userPassword FROM tblUsers WHERE userPassword = '" + Replace(rsWhoUser__MMColParam, "'", "''") + "'"
rsWhoUser.CursorType = 0
rsWhoUser.CursorLocation = 2
rsWhoUser.LockType = 1
rsWhoUser.Open()
Session("UserIDLogged")=rsWhoUser.Fields.Item("use rID").Value

rsWhoUser_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsNumber1_numRows = rsNumber1_numRows + Repeat1__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>testing recordsets</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<form name="form1" id="form1" method="post" action="">
<table width="100%" border="0" cellspacing="5">
    <tr>
     <td width="28%"><div align="center">Amount</div></td>
     <td width="30%"><div align="center">Price Offer </div></td>
    </tr>
    <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
    </tr>
    <%
While ((Repeat1__numRows <> 0) AND (NOT rsNumber1.EOF))
%>
    <tr>
     <td><div align="center"><%=(rsNumber1.Fields.Item("purchAmo unt").Value)%></div></td>
     <td><div align="center"><%=(rsNumber1.Fields.Item("valuePri ceOffer").Value)%></div></td>
    </tr>
    <%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsNumber1.MoveNext()
Wend
%>
    </table>
<p>&nbsp;</p>
<table width="100%" border="0" cellspacing="5">
    <tr>
     <td width="30%">Value From another recordset : </td>
     <td width="70%"><%=(rsNumber2.Fields.Item("TotalInvest ed").Value)%></td>
    </tr>
</table>
<p>&nbsp;</p>
</form>
</body>
</html>
<%
rsNumber1.Close()
Set rsNumber1 = Nothing
%>
<%
rsNumber2.Close()
Set rsNumber2 = Nothing
%>
<%
rsWhoUser.Close()
Set rsWhoUser = Nothing
%>
 
Old October 19th, 2005, 04:38 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Right, I see now.... The problem is not with the way or order the recordsets are opened, but it looks like it's with the parameters you feed to the SQL statements. Take a look at this:
Code:
If (Session("userIDLogged") <> "") Then 
  rsNumber1__MMColParam = Session("userIDLogged")
End If
Somewhere later you have this:
Code:
Session("UserIDLogged")=rsWhoUser.Fields.Item("userID").Value
Apparently, the session variable UserIDLogged is set by this page.

So, does it have a value when the page loads? I don't think so (although I am not sure). If it doesn't have a value, you don't get the records you expect. Then later in the page the session variable *is* set so when you reload the page, you do get the right values.

Could this be the problem?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old October 19th, 2005, 09:06 PM
Authorized User
 
Join Date: Jan 2005
Location: Sao Paulo, SP, Brazil.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

PERFECT , Imar. Simply perfect! :)

I created the Session variables "LoginLogged" and "PasswordLogged" in the login.asp page and...as soon as the redirected page loads, I must create and use the recordset that "finds" the userID to associate it with the UserIDLogged Session variable!

Thank you very very much. I could not be better supported.

Best regards,
Fábio.
 
Old October 20th, 2005, 10:44 AM
Authorized User
 
Join Date: Jan 2005
Location: Sao Paulo, SP, Brazil.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default


You were absolutely right, Imar.

Now the problem is 100% solved: I managed to put the "problematic" recordset just-before leaving the login page and... yes! It worked perfectly.

See you in my next difficulties ;) !

Thank you very much indeed.

All the best,
Fábio.









Similar Threads
Thread Thread Starter Forum Replies Last Post
Refresh problem hsucp2p PHP How-To 6 January 4th, 2008 07:02 PM
ASP Refresh problem MDrumm BOOK: Beginning ASP 3.0 2 May 25th, 2005 11:01 AM
Refresh Problem gkirk Beginning PHP 2 February 25th, 2005 04:14 PM





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