Get ready for BLACK FRIDAY shopping starting in

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>&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; &lt;/td&gt;
&lt;td width="597"&gt; &lt;/td&gt;
&lt;td width="171"&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="26"&gt; &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; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="26"&gt; &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; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="26"&gt; &lt;/td&gt;
&lt;td width="597" class="kursivliten"&gt; &lt;/td&gt;
&lt;td width="171"&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="26"&gt; &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>


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>&lt;%@LANGUAGE="VBSCRIPT"%&gt;
&lt;!--#include file="Connections/Test.asp" --&gt;

&lt;% if Session("mymove" = "" Then Session("mymove" = 0 %&gt;

&lt;%
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
%&gt;

&lt;% myRowCount = rsTest.RecordCount - 1 %&gt;

&lt;% rsTest.Move Session("mymove",1 %&gt;

&lt;% If Session("mymove" &lt; myRowCount Then
Session("mymove" = Session("mymove" + 1
ELse
Session("mymove" = 0
End If
%&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;meta http-equiv="refresh" content="5"&gt;
&lt;/head&gt;
&lt;body bgcolor="#FFFFFF" text="#000000"&gt;
&lt;%=(rsTest.Fields.Item("EmployeeName".Value)%&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;%
rsTest.Close()
%&gt; </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

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>

Reply to this topic