Det er nok nemmest at paste selve source koden til det så folk selv kan se
hvordan jeg fik dette til at virke.
Værsgo folkens:
<%
Function home()
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("../db/consider.mdb")
Conn.Open DSN
dim HTMLstr
strSQL = "Select top 5 * from home order by ID desc"
Set rs = Conn.Execute(strSQL)
count = 1
If Not (rs.BOF Or rs.EOF) Then
Do
id = RS("ID")
picture = RS("picture")
headline = RS("headline")
tekst = RS("tekst")
X = count mod 2
count = count + 1
HTMLstr = HTMLstr & "<table width='405' border='0' cellpadding='0'
cellspacing='0'>"
HTMLstr = HTMLstr & "<tr>"
If X = 0 Then
HTMLstr = HTMLstr & "<td width='150' valign='top' height='75'>"
HTMLstr = HTMLstr & "<img src='newspics/" & picture & "' border='0'
width='140' height='75'>"
HTMLstr = HTMLstr & "</td>"
HTMLstr = HTMLstr & "<td width='255' valign='top' height='75'>"
HTMLstr = HTMLstr & "<font face='verdana' size='2' color='#212E48'><b>" &
headline & "</b></font><br><a href='default.asp?page=Read&read=" & ID &
"'><font face='verdana' size='1'>" & tekst & "</font></a>"
HTMLstr = HTMLstr & "</td>"
End If
If X = 1 Then
HTMLstr = HTMLstr & "<td width='255' valign='top' height='75'>"
HTMLstr = HTMLstr & "<font face='verdana' size='2' color='#212E48'><b>" &
headline & "</b></font><br><a href='default.asp?page=Read&read=" & ID &
"'><font face='verdana' size='1'>" & tekst & "</font></a>"
HTMLstr = HTMLstr & "</td>"
HTMLstr = HTMLstr & "<td width='150' valign='top' height='75'>"
HTMLstr = HTMLstr & "<img src='newspics/" & picture & "' border='0'
width='140' height='75'>"
HTMLstr = HTMLstr & "</td>"
End If
HTMLstr = HTMLstr & "</tr>"
HTMLstr = HTMLstr & "<tr>"
HTMLstr = HTMLstr & "<td colspan='2' width='405'>"
HTMLstr = HTMLstr & "<font face='verdana' size='1'><center>"
If Session("rank") = "Webmaster" Or Session("rank") = "Manager" Then
HTMLstr = HTMLstr & "<font face='verdana' size='1'><a
href='default.asp?page=Edit&edit=" & ID &
"&tabel=home&prev=Home'><b>Edit</b></a> - </font>"
HTMLstr = HTMLstr & "<font face='verdana' size='1'><a
href='default.asp?page=Del&tabel=home&del=" & id &
"&prev=Home'><b>Delete</b></a></font>"
End If
HTMLstr = HTMLstr & "<br><hr>"
HTMLstr = HTMLstr & "</center></font>"
HTMLstr = HTMLstr & "</td>"
HTMLstr = HTMLstr & "</tr>"
HTMLstr = HTMLstr & "</table>"
rs.MoveNext
Loop While Not rs.EOF
end if
Conn.Close
Set Conn = Nothing
home = HTMLstr
End Function
%>
--
Vil du lære at kode HTML, XHTML, CSS, SSI, ASP eller ASP.NET?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials