Forums
This topic is locked
Desperate help needed ...
Posted 27 Feb 2007 23:02:53
1
has voted
27 Feb 2007 23:02:53 John Strubel posted:
I have created a simple list page of items in a DB using asp. When I try to view the individual records, they only display the first record in the DB. When I scroll over the hyperlink it points to the correct record, but on click, only displays the first record.Why? Can anyone help?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/checkin.asp" -->
<%
Dim rscheckin
Dim rscheckin_numRows
Set rscheckin = Server.CreateObject("ADODB.Recordset"
rscheckin.ActiveConnection = MM_checkin_STRING
rscheckin.Source = "SELECT * FROM Employee"
rscheckin.CursorType = 0
rscheckin.CursorLocation = 2
rscheckin.LockType = 1
rscheckin.Open()
rscheckin_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 10
Repeat1__index = 0
rscheckin_numRows = rscheckin_numRows + Repeat1__numRows
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "" Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "" Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "" Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "" Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "" Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Test</title>
<link href="../styles.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {color: #003366}
.style2 {
font-size: 16px;
font-weight: bold;
color: #990000;
}
.style4 { color: #003366;
font-weight: bold;
}
.style5 {
color: #990000;
font-weight: bold;
}
.style6 {color: #000000}
-->
</style>
</head>
<body>
<table width="600" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td><img src="images/masthead.jpg" width="600" height="75" /></td>
</tr>
</table>
<br />
<table width="600" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td><div align="center" class="style2">HUMAN RESOURCES USE ONLY</div></td>
</tr>
</table>
<br />
<%
While ((Repeat1__numRows <> 0) AND (NOT rscheckin.EOF))
%>
<table width="600" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="512"><div align="left"><%=(rscheckin.Fields.Item("LastName".Value)%>, <%=(rscheckin.Fields.Item("FirstName".Value)%> </div></td>
<td width="68"><div align="center"><A HREF="view.asp?<%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "ID=" & rscheckin.Fields.Item("ID".Value %>">view</A></div></td>
</tr>
</table>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rscheckin.MoveNext()
Wend
%>
<p align="center"> </p>
</body>
</html>
<%
rscheckin.Close()
Set rscheckin = Nothing
%>
John Strubel
Replies
Replied 01 Mar 2007 03:18:01
01 Mar 2007 03:18:01 Javier Castro replied:
apply Server Behaviour - Recorset paging - Move to specific record to your details page. That should solve your problem.
javier
javier
Replied 01 Mar 2007 18:14:58
01 Mar 2007 18:14:58 John Strubel replied:
Javier ... that worked ... I knew it was something simple I was missing ... THANKS FOR YOUR HELP!
John Strubel
John Strubel