Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

How to Loop a asp page?

Posted 18 Mar 2002 11:28:26
1
has voted
18 Mar 2002 11:28:26 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....

Can anyone help,?

Henrik

Replies

Replied 18 Mar 2002 14:47:49
18 Mar 2002 14:47:49 Andrew Watson replied:
You can try something along these lines...

The display page should have the recordset on it filtered by a variable (entered value).

This variable should be incremented every time the page is refreshed. then youre returned record will step through the recordset.

to set the incremental try something like this..
(Set this variable to 0 or 1 before this page or use the session on start or something)

<ASP%

varMyIncremental = varMyIncremental + 1

%ASP>

the recordset should have a key column of an incrementing number this is then filtered with the variable above and each time the page is refreshed the next record is displayed.

Use a simple refresh action in the header content to refresh after X seconds.

Oh, once the recordset gets to the end it will stop so you should state somewhere that if EOF is true then go back to the beginning of the recordset.
Replied 19 Mar 2002 11:59:46
19 Mar 2002 11:59:46 Henrik Sandeberg replied:
ok, thanks, i will try this, i had something like this in mind but i couldnt do it. I post the page,, meybe you can help me with the code....

code:
<pre id=code><font face=courier size=2 id=code>&lt;%@LANGUAGE="VBSCRIPT"%&gt;
&lt;!--#include file="../../Connections/iTV.asp" --&gt;
&lt;%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "JA"
if (Request("MM_EmptyValue" &lt;&gt; "" then Recordset1__MMColParam = Request("MM_EmptyValue"
%&gt;
&lt;%
Dim TidAttVisa
%&gt;
&lt;%
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
%&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;link rel="stylesheet" href="../../include/amf1.css" type="text/css"&gt;
&lt;style type="text/css"&gt;
&lt;!--
.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}
--&gt;
&lt;/style&gt;
&lt;meta http-equiv="refresh" content="&lt;%=(Recordset1.Fields.Item("visastid".Value)%&gt;"&gt;
&lt;/head&gt;
&lt;body bgcolor="#FFFFFF" text="#000000"&gt;
&lt;table width="800" border="0" cellspacing="0" cellpadding="1"&gt;
&lt;tr&gt;
&lt;td colspan="3"&gt;
&lt;div align="center" class="headerstor"&gt;&lt;%=(Recordset1.Fields.Item("overskrift".Value)%&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="26"&gt;&nbsp;&lt;/td&gt;
&lt;td width="597"&gt;&nbsp;&lt;/td&gt;
&lt;td width="171"&gt;&nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="26"&gt;&nbsp;&lt;/td&gt;
&lt;td width="597"&gt;
&lt;div align="left"&gt;&lt;/div&gt;
&lt;img src="&lt;%=(Recordset1.Fields.Item("bildlank".Value)%&gt;" border="0"&gt;&lt;/td&gt;
&lt;td width="171"&gt;&nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="26"&gt;&nbsp;&lt;/td&gt;
&lt;td width="597" class="norm12"&gt;&lt;%=(Recordset1.Fields.Item("ingress".Value)%&gt;&lt;/td&gt;
&lt;td width="171"&gt;&nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="26"&gt;&nbsp;&lt;/td&gt;
&lt;td width="597" class="kursivliten"&gt;&nbsp;&lt;/td&gt;
&lt;td width="171"&gt;&nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="26"&gt;&nbsp;&lt;/td&gt;
&lt;td width="597" class="kursivliten"&gt;&lt;%=(Recordset1.Fields.Item("autodatum".Value)%&gt;&lt;/td&gt;
&lt;td width="171"&gt;&lt;span class="kursivliten"&gt;Inlagt av:&lt;/span&gt; &lt;span class="kursivliten"&gt;&lt;%=(Recordset1.Fields.Item("inlagtav".Value)%&gt;&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;%
Recordset1.Close()
%&gt;
</font id=code></pre id=code>

Reply to this topic