Avatar billede vtm Nybegynder
15. juni 2003 - 23:12 Der er 6 kommentarer og
1 løsning

Vis kun de første 3

Jeg har en nyheds viser, som kun skal vise de første 3 beskeder i stedet for alle.

<%
Response.Buffer = True

' Connection til database
Set Con = Server.CreateObject("ADODB.Connection")
DBPath = "DBQ=" & server.mappath("admin/nyheder.mdb")
Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & DBPath

' Her hiver vi indholdet af databasen ud, sorterer dem efter dato
    Sql = "SELECT * FROM nyheder ORDER BY Dato DESC"
    Set Record =  Con.Execute(Sql)

%>
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>forside</title>
</head>

<body bgproperties="fixed" background="grafik/Pil_13.jpg" link="#3366FF" vlink="#3366FF" alink="#3366FF" bgcolor="#000000">

<p align="center"><u><b><font face="Verdana" size="6">~*Chrisas Chinchilla*~</font></b></u></p>


&nbsp;<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
  <tr>
    <td width="50%"><center><b><u><font size="2" face="Verdana">Nyheder</font></u></b></center><hr>
    <% Do While Not Record.EOF %>
       
        <b><font size="2" face="Verdana">Den : </font> </b>
    <font size="2" face="Verdana"><% Response.Write Record("Dato")%></font><br>
        <font face="Verdana">
        <b><font size="2">Navn : </font> </b><font size="2"><% Response.Write Record("Forfatter")%><br>
        <b>Nyhed : </b><% Response.Write Record("Nyhed") %></font></font><br>
<br></p>
    <hr>

<%
Record.MoveNext
Loop
%>

  <%
' Lukke connection
Con.Close
Set Con = Nothing
%> 
    </td>
    <td width="50%">


<APPLET height=400
      archive=../Billeder/web/bilder%20til%20forside/AnLake.jar width=287
      code=AnLake.class align="right"><PARAM NAME="credits" VALUE="Applet by Fabio Ciucci (www.anfyteam.com)"><PARAM NAME="res" VALUE="1"><PARAM NAME="image" VALUE="Peja 19.jpg"><PARAM NAME="wavspeed" VALUE="30"><PARAM NAME="perspective" VALUE="10"><PARAM NAME="farwaving" VALUE="200"><PARAM NAME="wind" VALUE="10"><PARAM NAME="windvarval" VALUE="5"><PARAM NAME="windvarmin" VALUE="5"><PARAM NAME="windvarmax" VALUE="15"><PARAM NAME="halfreflect" VALUE="NO"><PARAM NAME="overimg" VALUE="NO"><PARAM NAME="overimgX" VALUE="0"><PARAM NAME="overimgY" VALUE="0"><PARAM NAME="textscroll" VALUE="lakescr.txt"><PARAM NAME="texttype" VALUE="zooming"><PARAM NAME="textvspace" VALUE="0"><PARAM NAME="textminfont" VALUE="8"><PARAM NAME="textmaxfont" VALUE="172"><PARAM NAME="textoffset" VALUE="240"><PARAM NAME="textspeed" VALUE="2"><PARAM NAME="textfont" VALUE="Helvetica"><PARAM NAME="textbold" VALUE="NO"><PARAM NAME="textitalic" VALUE="NO"><PARAM NAME="textsize" VALUE="24"><PARAM NAME="textshadow" VALUE="YES"><PARAM NAME="TextSColR" VALUE="20"><PARAM NAME="TextSColG" VALUE="20"><PARAM NAME="TextSColB" VALUE="50"><PARAM NAME="TextColR" VALUE="255"><PARAM NAME="TextColG" VALUE="255"><PARAM NAME="TextColB" VALUE="155"><PARAM NAME="TextJumpAmp" VALUE="0"><PARAM NAME="TextJumpSpd" VALUE="0"><PARAM NAME="TextSineAmp" VALUE="0"><PARAM NAME="TextSineSpd" VALUE="0"><PARAM NAME="TextSineAngle" VALUE="0"><PARAM NAME="regcode" VALUE="NO"><PARAM NAME="reglink" VALUE="NO"><PARAM NAME="regnewframe" VALUE="NO"><PARAM NAME="regframename" VALUE="_blank"><PARAM NAME="statusmsg" VALUE="AnLake applet"><PARAM NAME="memdelay" VALUE="1000"><PARAM NAME="priority" VALUE="3"><PARAM NAME="MinSYNC" VALUE="10">
  Sorry, your browser doesn't support Java(tm).</APPLET></td>
  </tr>
  <tr>
    <td width="100%" colspan="2">
    <p style="line-height: 100%; margin-top: 1px; margin-bottom: 1px" align="center">&nbsp;</p>
    <p style="line-height: 100%; margin-top: 1px; margin-bottom: 1px" align="center">&nbsp;</p>
    <p style="line-height: 100%; margin-top: 1px; margin-bottom: 1px" align="center">&nbsp;</p>
    <p style="line-height: 100%; margin-top: 1px; margin-bottom: 1px" align="center">
    <font face="Times New Roman" color="#000000" size="2">Alle rettigheder
    forbeholdes / Copyright 2003 <a href="mailto:chrisas@chrisas-chinchilla.dk">
    Dorthe Tomicich</a></font></p>
    <center>
    <p style="margin-top: 2px" align="center">&nbsp;<font face="Times New Roman" color="#000000" size="1">Sidst
    opdateret d.&nbsp; 08-06-03 </font></p>
    </center></td>
  </tr>
</table>
</body>

</html>
Avatar billede vtm Nybegynder
15. juni 2003 - 23:14 #1
ASP koden i sig selv

<%
Response.Buffer = True

' Connection til database
Set Con = Server.CreateObject("ADODB.Connection")
DBPath = "DBQ=" & server.mappath("admin/nyheder.mdb")
Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & DBPath

' Her hiver vi indholdet af databasen ud, sorterer dem efter dato
    Sql = "SELECT * FROM nyheder ORDER BY Dato DESC"
    Set Record =  Con.Execute(Sql)

%>

<% Do While Not Record.EOF %>
       
        <b><font size="2" face="Verdana">Den : </font> </b>
    <font size="2" face="Verdana"><% Response.Write Record("Dato")%></font><br>
        <font face="Verdana">
        <b><font size="2">Navn : </font> </b><font size="2"><% Response.Write Record("Forfatter")%><br>
        <b>Nyhed : </b><% Response.Write Record("Nyhed") %></font></font><br>
<br></p>
    <hr>

<%
Record.MoveNext
Loop
%>

  <%
' Lukke connection
Con.Close
Set Con = Nothing
%>
Avatar billede dsjk Novice
15. juni 2003 - 23:14 #2
Sql = "SELECT top 3 * FROM nyheder ORDER BY Dato DESC"


dsjk
Avatar billede whatever Nybegynder
15. juni 2003 - 23:14 #3
Ret denne linie:

  Sql = "SELECT * FROM nyheder ORDER BY Dato DESC"

til

  Sql = "SELECT TOP 3 * FROM nyheder ORDER BY Dato DESC"
Avatar billede cyigen Nybegynder
15. juni 2003 - 23:15 #4
<%
Response.Buffer = True

' Connection til database
Set Con = Server.CreateObject("ADODB.Connection")
DBPath = "DBQ=" & server.mappath("admin/nyheder.mdb")
Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & DBPath

' Her hiver vi indholdet af databasen ud, sorterer dem efter dato
    Sql = "SELECT TOP 3* FROM nyheder ORDER BY Dato DESC"
    Set Record =  Con.Execute(Sql)

%>
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>forside</title>
</head>

<body bgproperties="fixed" background="grafik/Pil_13.jpg" link="#3366FF" vlink="#3366FF" alink="#3366FF" bgcolor="#000000">

<p align="center"><u><b><font face="Verdana" size="6">~*Chrisas Chinchilla*~</font></b></u></p>


&nbsp;<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
  <tr>
    <td width="50%"><center><b><u><font size="2" face="Verdana">Nyheder</font></u></b></center><hr>
    <% Do While Not Record.EOF %>
       
        <b><font size="2" face="Verdana">Den : </font> </b>
    <font size="2" face="Verdana"><% Response.Write Record("Dato")%></font><br>
        <font face="Verdana">
        <b><font size="2">Navn : </font> </b><font size="2"><% Response.Write Record("Forfatter")%><br>
        <b>Nyhed : </b><% Response.Write Record("Nyhed") %></font></font><br>
<br></p>
    <hr>

<%
Record.MoveNext
Loop
%>

  <%
' Lukke connection
Con.Close
Set Con = Nothing
%> 
    </td>
    <td width="50%">


<APPLET height=400
      archive=../Billeder/web/bilder%20til%20forside/AnLake.jar width=287
      code=AnLake.class align="right"><PARAM NAME="credits" VALUE="Applet by Fabio Ciucci (www.anfyteam.com)"><PARAM NAME="res" VALUE="1"><PARAM NAME="image" VALUE="Peja 19.jpg"><PARAM NAME="wavspeed" VALUE="30"><PARAM NAME="perspective" VALUE="10"><PARAM NAME="farwaving" VALUE="200"><PARAM NAME="wind" VALUE="10"><PARAM NAME="windvarval" VALUE="5"><PARAM NAME="windvarmin" VALUE="5"><PARAM NAME="windvarmax" VALUE="15"><PARAM NAME="halfreflect" VALUE="NO"><PARAM NAME="overimg" VALUE="NO"><PARAM NAME="overimgX" VALUE="0"><PARAM NAME="overimgY" VALUE="0"><PARAM NAME="textscroll" VALUE="lakescr.txt"><PARAM NAME="texttype" VALUE="zooming"><PARAM NAME="textvspace" VALUE="0"><PARAM NAME="textminfont" VALUE="8"><PARAM NAME="textmaxfont" VALUE="172"><PARAM NAME="textoffset" VALUE="240"><PARAM NAME="textspeed" VALUE="2"><PARAM NAME="textfont" VALUE="Helvetica"><PARAM NAME="textbold" VALUE="NO"><PARAM NAME="textitalic" VALUE="NO"><PARAM NAME="textsize" VALUE="24"><PARAM NAME="textshadow" VALUE="YES"><PARAM NAME="TextSColR" VALUE="20"><PARAM NAME="TextSColG" VALUE="20"><PARAM NAME="TextSColB" VALUE="50"><PARAM NAME="TextColR" VALUE="255"><PARAM NAME="TextColG" VALUE="255"><PARAM NAME="TextColB" VALUE="155"><PARAM NAME="TextJumpAmp" VALUE="0"><PARAM NAME="TextJumpSpd" VALUE="0"><PARAM NAME="TextSineAmp" VALUE="0"><PARAM NAME="TextSineSpd" VALUE="0"><PARAM NAME="TextSineAngle" VALUE="0"><PARAM NAME="regcode" VALUE="NO"><PARAM NAME="reglink" VALUE="NO"><PARAM NAME="regnewframe" VALUE="NO"><PARAM NAME="regframename" VALUE="_blank"><PARAM NAME="statusmsg" VALUE="AnLake applet"><PARAM NAME="memdelay" VALUE="1000"><PARAM NAME="priority" VALUE="3"><PARAM NAME="MinSYNC" VALUE="10">
  Sorry, your browser doesn't support Java(tm).</APPLET></td>
  </tr>
  <tr>
    <td width="100%" colspan="2">
    <p style="line-height: 100%; margin-top: 1px; margin-bottom: 1px" align="center">&nbsp;</p>
    <p style="line-height: 100%; margin-top: 1px; margin-bottom: 1px" align="center">&nbsp;</p>
    <p style="line-height: 100%; margin-top: 1px; margin-bottom: 1px" align="center">&nbsp;</p>
    <p style="line-height: 100%; margin-top: 1px; margin-bottom: 1px" align="center">
    <font face="Times New Roman" color="#000000" size="2">Alle rettigheder
    forbeholdes / Copyright 2003 <a href="mailto:chrisas@chrisas-chinchilla.dk">
    Dorthe Tomicich</a></font></p>
    <center>
    <p style="margin-top: 2px" align="center">&nbsp;<font face="Times New Roman" color="#000000" size="1">Sidst
    opdateret d.&nbsp; 08-06-03 </font></p>
    </center></td>
  </tr>
</table>
</body>

</html>
Avatar billede cyigen Nybegynder
15. juni 2003 - 23:16 #5
det hele er der ----^
Avatar billede vtm Nybegynder
15. juni 2003 - 23:19 #6
Takker Mange Gange :)
Avatar billede dsjk Novice
15. juni 2003 - 23:27 #7
ingen årsag.

Takker for point;O)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester