> Start med at sende os hele koden for siden - så burde det være muligt og
se
> hvad der kan gøres.
>
Dette er gæstebogen
<div id="indhold">
<h1 style="margin-bottom:0px"><%Response.Write strTitle%></h1>
<%
Select Case strMode
Case "add"
%>
<%
Case Else
strAddLine = "<p><a class='tlink' href='gaestebog.asp?mode=add'>Skriv et
indlæg i gæstebogen</a></a>.</p>"
Response.Write strAddLine
strSQL = "SELECT * FROM Guestbook ORDER BY Dato DESC;"
Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open tempConn
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
Do While Not rs.EOF
dtmDato = rs("Dato")
dtmDato = FormatDateTime(dtmDato,vbLongDate) & " kl. " &
FormatDateTime(dtmDato,vbLongTime)
Response.Write "<div style='border: solid 1px #ccf;padding: 5px'>Den " &
dtmDato & " skrev "
If Len(rs("Email")) > 0 Then
Response.Write "<a class='tlink' href='mailto:" & rs("Email") & "'>" &
rs("Navn") & "</a>:<br />"
End If
Response.Write "<b>" & rs("Overskrift") & "</b><br />"
strContent= replace(rs("Kommentar") & "",VbCrLf,"<br />")
Response.Write strContent & "</div><br />"
rs.MoveNext
Loop
Else
Response.Write "<p class='fejl'>Der er endnu ikke nogen, der har skrevet i
gæstebogen</p>"
End If
myConn.Close
Set myConn = Nothing
Response.Write strAddLine
End Select
%>
<p></p>
</div>
Dette er dagbogen
<%
' --------------------------------------------------------------------------
------
' Dette eksempel er skrevet af Dennis Knappe
' Og omskrevet af Lars Hansen/Ole H. hansen - logiweb.dk
' Eksemplet kan downloades fra
http://www.activeserverpages.dk, og er
freeware
' --------------------------------------------------------------------------
------
Const adOpenKeyset = 1
Const adLockOptimistic = 3
strMode = Request.QueryString("mode")
tempConn = "PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};DBQ="
& Server.MapPath("news.mdb") & ";UID=admin;PWD=;"
If Request.Form("Gem") <> "" Then
strNavn = Trim(Request.Form("Overskrift"))
strKommentar = Trim(Request.Form("Kommentar"))
Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT * FROM news WHERE (ID = 0)"
rs.Open strSQL, tempConn, adOpenKeyset, adLockOptimistic
If (rs.BOF Or rs.EOF) Then
rs.AddNew
rs("Overskrift") = strNavn
rs("Kommentar") = strKommentar
rs("Dato") =Date()
rs.Update
End If
rs.Close
Set rs = Nothing
End If
%>
<html>
<head>
<title>Nyheder</title>
</head>
<body>
<div align="center"><center>
<table width="400" border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="400"><b><font face="Arial" size="2">Min
dagbog</font></b><font face="Arial" size="2" color="Black"><br>
<br>
</font></td>
</tr>
<tr align="center">
<td width="100%"><%
Select Case strMode
Case "add"
%>
<%
Case Else
Set myConn = Server.CreateObject("ADODB.Connection")
strSQL = "SELECT top 5 * FROM news ORDER BY Dato DESC;"
myConn.Open tempConn
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
Response.Write "<table border=0 cellpadding=3 cellspacing=0>"
Do While Not rs.EOF
Select Case weekday(rs("Dato"))
case 1 dag = "Søndag"
case 2 dag = "Mandag"
case 3 dag = "Tirsdag"
case 4 dag = "Onsdag"
case 5 dag = "Torsdag"
case 6 dag = "Fredag"
case 7 dag = "Lørdag"
End Select
Select Case month(rs("Dato"))
case 1 maaned = " januar "
case 2 maaned = " februar "
case 3 maaned = " marts "
case 4 maaned = " april "
case 5 maaned = " maj "
case 6 maaned = " juni "
case 7 maaned = " juli "
case 8 maaned = " august "
case 9 maaned = " september "
case 10 maaned = " oktober "
case 11 maaned = " november "
case 12 maaned = " december "
End Select
Response.Write "<tr bgcolor=#AAAAD5><td><font face=arial size=2><B>" & dag &
" d. " & day(rs("Dato")) & maaned & year(rs("Dato")) & " - " &
rs("Overskrift") & "</B></td></tr>"
'response.write year(rs("Dato"))
Response.Write "<tr><td><font face=arial size=2>" & rs("kommentar") &
"<br> </td></tr>"
rs.MoveNext
Loop
Response.Write "</table>"
Else
Response.Write "<p><font face=arial size=2>Der er endnu ikke nogle nyheder
i databasen endnu</font></p>"
End If
myConn.Close
Set myConn = Nothing
End Select
%>
</td>
</tr>
</table>
</center></div>
</body>
</html>