Jeg har lidt bøvl med denne kode hvilket jeg ville håbe at der
sad en
person som kunne løse det for mig:
Jeg er lidt på den da jeg ikke lige ved hvad jeg skal rette i.
linie 168 i filen vis_alle.asp:
end if
If RS.EOF then (linien 168 her)
response.write "<br>Der er ikke flere beskeder<br>"
end if
----------------------------------------------------------------
Fejl meddelsen fra serveren:
Viser nu besked 1 til 3
ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
/test1/nyhed/vis_alle.asp, line 168
-----------------------------------------------------------------
-------
Se hele koden her:
<%
Hits = 5 ' <<< Vælg antallet af beskeder pr. side >>>
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ="&Server.Mappath("database.mdb")
sql = "select count(id) as antal from nyheder "
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open sql, conn, 1, 3
antal = rs("antal")
sql = "select * from nyheder order by id desc"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open sql, conn, 1, 3
%>
<html>
<head>
</head>
<p align="center" style="margin-top: 0; margin-bottom: 0"></p>
<p align="center" style="margin-top: 0; margin-bottom: 0"></p>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111"
width="30%" id="AutoNumber8">
<tr>
<td width="100%">
<p align="center" style="margin-top: 0; margin-bottom:
0"><!--webbot bot="HTMLMarkup" startspan --><%
Set objBanner = Server.CreateObject("MSWC.AdRotator")
objBanner.TargetFrame = "_BLANK"
Response.Write objBanner.GetAdvertisement("/test1/bannere.txt")
%>
<!--webbot bot="HTMLMarkup" endspan --></p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<font color="#FF0000" size="2" face="Tahoma">Tak til</font></td>
</tr>
</table>
</center>
</div>
<p align="center"></p>
<table border="1" cellspacing="1" width="96%" id="AutoNumber4"
bordercolor="#0099FF" bgcolor="#000000" height="1">
<tr>
<th width="12%" nowrap valign="top" bgcolor="#000000" height="1">
<p align="left"><font color="#FFFFFF"><!--webbot bot="HTMLMarkup"
startspan --><html>
<head>
</head>
<body>
<!--#include virtual="/test1/venmenu.asp"-->
</body>
</html>
<!--webbot bot="HTMLMarkup" endspan --></font></th>
<td width="44%" valign="top" bgcolor="#000000"
style="word-spacing: 0; text-indent: 0; line-height: 100%;
margin: 0" bordercolor="#76AEC4" height="1">
<table border="1" cellspacing="1" style="border-collapse:
collapse" bordercolor="#0099FF" width="100%" id="AutoNumber7"
bgcolor="#0099FF" height="1">
<tr>
<td width="100%" bgcolor="#0099FF" bordercolor="#0099FF"
height="1" valign="top" style="text-indent: 0; line-height: 100%;
word-spacing: 0; margin: 0">
<!-- URL's used in the movie-->
<!-- text used in the movie-->
<!--FLOORBALLLIFE.COMVVEVEJVEJEVEJENVEJEN VEJEN T VEJEN TI VEJEN
TIL VEJEN TIL VEJEN TIL F VEJEN TIL FL VEJEN TIL FLO VEJEN TIL
FLOO VEJEN TIL FLOOR VEJEN TIL FLOORB VEJEN TIL FLOORBA VEJEN TIL
FLOORBAL VEJEN TIL FLOORBALL -->
<p style="margin-top: 0; margin-bottom: 0">
<noscript></noscript></td>
</tr>
<tr>
<td width="100%" bgcolor="#76AEC4" bordercolor="#0099FF"
height="1" valign="top">
<p style="margin-top: 0; margin-bottom: 0"><!--webbot
bot="HTMLMarkup" startspan --><index>
</index>
<!--webbot bot="HTMLMarkup" endspan --><!--webbot
bot="HTMLMarkup" startspan --><html>
<head>
<title>xxx</title>
<link rel="stylesheet" type="text/css" href="mitstylesheet.css">
</head>
<!--webbot bot="HTMLMarkup" endspan
--> &n
bsp; &
nbsp;
 
;
<font size="2"> Ny bruger -
<a href="../ny.ASP">Opret profil</a> | Glemt password -
<a target="_blank" href="../login.ASP">Klik her</a></font></td>
</tr>
</table>
<TABLE cellSpacing=0 cellPadding=0 width=633 border=1
height="264" bordercolor="#0099FF" style="border-collapse:
collapse; border-top-width: 2">
<TBODY>
<TR>
<TD
style="PADDING-LEFT: 6px; PADDING-TOP: 9px; BACKGROUND-REPEAT:
no-repeat; font-size:11px; color:#ffffff;
font-family:Verdana,Arial; border-left-color:#000000;
border-left-width:2"
vAlign=top width=320 bgColor=#FF0000
height=33 bordercolor="#0099FF">
</TD>
</TR>
</TBODY></TABLE>
<TABLE class=text cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TR>
<TD width="100%" bgColor=#FF0000> </TD></TR>
<TR>
<TD bgColor=#ffffff> <font size="2"> <BR>
</font>
<HR noShade color="#000000">
</TD></TR>
</TABLE>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"> </td>
<td width="12%" valign="top" bgcolor="#000000"
style="word-spacing: 0; text-indent: 0; line-height: 100%;
margin: 0" height="1">
<font color="#FFFFFF" size="2"><!--webbot bot="HTMLMarkup"
startspan --><html>
<head>
</head>
<body>
<!--#include virtual="/test1/hojremenu.asp"-->
</body>
</html>
<!--webbot bot="HTMLMarkup" endspan --></font></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<tr><td><table width='90%' align='center'>
<tr><td><b>Nyheder<br><hr></td></tr>
<tr>
<td>
<%
if request("StartAt") = "" then
StartAt = 0
else
StartAt = request("StartAt")
end if
For i = 1 To StartAt
If Not rs.EOF then
rs.MoveNext
end if
Next
Response.Write "<center>"
response.write "Viser nu besked " & StartAt+1 & " til "
if StartAt+Hits < Antal then
response.write StartAt+Hits & "<br>"
else
%>
<%=Antal%><br>
<%
end if
If RS.EOF then
response.write "<br>Der er ikke flere beskeder<br>"
end if
Sub ShowPages(bType)
response.write "Side(r): "
if StartAt > 0 then
response.write "<a href=?StartAt=" & StartAt-Hits & "> <<</a>"
end if
if Antal =< Hits then
response.write " 1 "
else
Pages = antal/Hits
if not Len(FormatNumber(Pages,0)) = Len(Pages) then
Pages = Pages + 1
end if
For i = 1 To Pages
if (StartAt/Hits)+1 = i then
response.write " " & i
else
response.write " <a href=?StartAt=" & (i*Hits)-Hits & ">" & i &
"</a> "
end if
Next
end if
if StartAt+Hits < Antal then
response.write " <a href=?StartAt=" & StartAt+Hits & "> >></a>"
end if
End Sub
ShowPages(1)
Response.write "<table width='100%'>"
For i = 1 To Hits
If not RS.EOF then %>
<TR><TD COLSPAN="3"><hr><br></TD></TR>
<tr><td><b>Emne: </b><%=rs("overskrift")%><br></td><td><b>Dato:
</b><%=RS("dato")%></td><td align="right"><a
href="vis_nyhed.asp?id=<%=rs("id")%>">
Læs mere om det her...</a></td></tr>
<%
rs.MoveNext
end if
Next
Response.Write "</table>"
Response.Write "<br><center>"
ShowPages(1)
%></body></html>
---------------------------------------------------------
Mvh
Søren Larsen
--
Vil du lære at kode HTML, XHTML, CSS, SSI eller ASP?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials