Som mit tidligere indlæg viser, så er jeg ny udi ASP. Links,
AbsoutPage etc. har jeg fået til at virke. Men hvad kan jeg gøre mere
effektiv ved understående kode...?
<%@ Language=VBScript %>
<% Response.Buffer=true %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Snedkers test">
</HEAD>
<BODY>
<%
'
http://www.aspfree.com/authors/bipin/adorecordsetpaging.asp
dim rs,i,con,strTemp, recCount
set rs=server.CreateObject("adodb.recordset")
rs.CursorLocation=3 'clientside
rs.CursorType=3 'staticrecordset
rs.PageSize=25
set con=Server.CreateObject("ADODB.Connection")
con.ConnectionString="Provider=sqloledb;Data Source=K1;Initial
Catalog=dbConsult;User Id=sa;Password=3432;"
con.Open
rs.Open "select * from kunde Order By Firma", con
recCount = rs.recordcount
Response.Write "<table><tr>"
for i=1 to rs.PageCount
Response.Write "<td><a href=default.asp?pg=" & i & ">" & i &
"</a></td>"
if rs.eof then exit for
next
Response.Write "</tr></table><br>"
if Request.QueryString("pg")="" then
rs.AbsolutePage=1
For i=1 to 25
%>
<table border="1" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#888888" width="100%"
id="AutoNumber1">
<tr>
<td width="100%"><%Response.Write
rs("firma")%></td>
</tr>
</table>
<%
rs.MoveNext
Next
else
rs.AbsolutePage=cint(Request.QueryString("pg"))
%>
<table border="1" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#888888" width="100%"
id="AutoNumber1">
<thead>
<tr>
<td width="45%"><b>Firma</b></td>
<td width="45%"><b>Adresse</b></td>
<td width="10%"><b>TelefonNr</b></td>
</tr>
</thead>
<tbody>
<%For i=1 to 25%>
<table border="1" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#888888" width="100%"
id="AutoNumber1">
<tr>
<td width="45%"><%Response.Write rs("firma")%></td>
<td width="45%"><%Response.Write rs("adresse")%></td>
<td width="10%"><%Response.Write
rs("telefonnr")%></td>
</tr>
</table>
</tbody>
<%
if rs.absoluteposition = recCount then exit for
rs.MoveNext
Next
end if
%>
</BODY>
</HTML>
På forhånd tak.
/Snedker
---
Klip det citerede væk, du ikke besvarer
Besvar venligst under det citerede