Forums
This topic is locked
Loop a ASP page again?!!!
Posted 27 Mar 2002 10:19:12
1
has voted
27 Mar 2002 10:19:12 Henrik Sandeberg posted:
I have an ACCESS db and a index.asp page that consists of a recordset, I want to repeat the records on the page after some time, etc 5 sec, but i will only show 1 record on the page at the same time. And when the last record is shown i will have the first record in the db shown again. A loop something....I have tried to use refresh but i cant get it to count up the variable.
Can anyone help,?
code:
<pre id=code><font face=courier size=2 id=code><%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/iTV.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "JA"
if (Request("MM_EmptyValue" <> "" then Recordset1__MMColParam = Request("MM_EmptyValue"
%>
<%
Dim TidAttVisa
%>
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_iTV_STRING
Recordset1.Source = "SELECT * FROM pres WHERE visa = '" + Replace(Recordset1__MMColParam, "'", "''" + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../../include/amf1.css" type="text/css">
<style type="text/css">
<!--
.kursivliten { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; font-style: italic; color: #666666}
.headerstor { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-weight: bold; text-decoration: underline}
-->
</style>
<meta http-equiv="refresh" content="<%=(Recordset1.Fields.Item("visastid".Value)%>">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="800" border="0" cellspacing="0" cellpadding="1">
<tr>
<td colspan="3">
<div align="center" class="headerstor"><%=(Recordset1.Fields.Item("overskrift".Value)%></div>
</td>
</tr>
<tr>
<td width="26"> </td>
<td width="597"> </td>
<td width="171"> </td>
</tr>
<tr>
<td width="26"> </td>
<td width="597">
<div align="left"></div>
<img src="<%=(Recordset1.Fields.Item("bildlank".Value)%>" border="0"></td>
<td width="171"> </td>
</tr>
<tr>
<td width="26"> </td>
<td width="597" class="norm12"><%=(Recordset1.Fields.Item("ingress".Value)%></td>
<td width="171"> </td>
</tr>
<tr>
<td width="26"> </td>
<td width="597" class="kursivliten"> </td>
<td width="171"> </td>
</tr>
<tr>
<td width="26"> </td>
<td width="597" class="kursivliten"><%=(Recordset1.Fields.Item("autodatum".Value)%></td>
<td width="171"><span class="kursivliten">Inlagt av:</span> <span class="kursivliten"><%=(Recordset1.Fields.Item("inlagtav".Value)%></span></td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
%>
</font id=code></pre id=code>
Henrik
Edited by - smalbenet on 27 Mar 2002 10:24:09
Edited by - smalbenet on 27 Mar 2002 10:25:46
Replies
Replied 27 Mar 2002 18:23:52
27 Mar 2002 18:23:52 Andrew Watson replied:
This is one way to do it, im sure therses probalby a better way but this will just scroll through a recordset as a page is refreshed, hope it is of help and apologies for the messy code but its almost 5.30 .....
<pre id=code><font face=courier size=2 id=code><%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/Test.asp" -->
<% if Session("mymove" = "" Then Session("mymove" = 0 %>
<%
set rsTest = Server.CreateObject("ADODB.Recordset"
rsTest.ActiveConnection = MM_Test_STRING
rsTest.Source = "SELECT * FROM tblEmployees"
rsTest.CursorType = 1
rsTest.CursorLocation = 2
rsTest.LockType = 3
rsTest.Open()
rsTest_numRows = 0
%>
<% myRowCount = rsTest.RecordCount - 1 %>
<% rsTest.Move Session("mymove",1 %>
<% If Session("mymove" < myRowCount Then
Session("mymove" = Session("mymove" + 1
ELse
Session("mymove" = 0
End If
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="5">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<%=(rsTest.Fields.Item("EmployeeName".Value)%>
</body>
</html>
<%
rsTest.Close()
%> </font id=code></pre id=code>
Cheers
Leed
Edited by - leed on 27 Mar 2002 18:25:06
Edited by - leed on 27 Mar 2002 18:26:10
<pre id=code><font face=courier size=2 id=code><%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/Test.asp" -->
<% if Session("mymove" = "" Then Session("mymove" = 0 %>
<%
set rsTest = Server.CreateObject("ADODB.Recordset"
rsTest.ActiveConnection = MM_Test_STRING
rsTest.Source = "SELECT * FROM tblEmployees"
rsTest.CursorType = 1
rsTest.CursorLocation = 2
rsTest.LockType = 3
rsTest.Open()
rsTest_numRows = 0
%>
<% myRowCount = rsTest.RecordCount - 1 %>
<% rsTest.Move Session("mymove",1 %>
<% If Session("mymove" < myRowCount Then
Session("mymove" = Session("mymove" + 1
ELse
Session("mymove" = 0
End If
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="5">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<%=(rsTest.Fields.Item("EmployeeName".Value)%>
</body>
</html>
<%
rsTest.Close()
%> </font id=code></pre id=code>
Cheers
Leed
Edited by - leed on 27 Mar 2002 18:25:06
Edited by - leed on 27 Mar 2002 18:26:10
Replied 28 Mar 2002 09:50:40
28 Mar 2002 09:50:40 Henrik Sandeberg replied:
Thank you very very much, this is just what i needed.
Regards
Henrik
Regards
Henrik
Replied 28 Mar 2002 15:53:17
28 Mar 2002 15:53:17 Andrew Watson replied:
If you copy and paste this make sure and replace the asterisks in the first meta tag with what was actually there! they replace
a r s e !!! (not trying to offend!!)<img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>
a r s e !!! (not trying to offend!!)<img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>