Udskriv en tabel i flere step fra databasen.
Hej,Jeg har behov for lidt asp-hjælp. Min tabel i databasen skal udskrives på siden i flere step. Jeg ved ikke helt om man skal skrive nogle tal i en kolonne så man nemmere kan kende de forskellige rækker??
Men først har jeg lavet en lille forklaring så det er nemmere at forstå.
http://www.2access.dk/nyt/layout.gif
Jeg vil blive meget glad hvis nogle kan komme med et eksempel, som jeg kan bruge.
Her kommer koden som jeg bruger nu.
<%
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("forum.mdb")
Function DBFix(tempString)
tempString = Replace(Trim(tempString), "'", "''")
tempString = Replace(tempString, "|", "")
DBFix = tempString
End Function
%>
<%
Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open strDSN
strSQL = "SELECT * FROM Forums"
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
Do While Not rs.EOF
strSQL = "SELECT *, Format$([date],'dd-mm-yyyy') AS FormDate, Format$([date],'hh:mm') AS FormTime FROM Entries WHERE (ForumID =" & rs("Id") & ") ORDER BY ID DESC"
Set formatDate = myConn.Execute(strSQL)
If (formatDate.BOF Or formatDate.EOF) Then
dtmFormatDate = "Ingen indlæg"
Else
dtmFormatDate = formatDate("FormDate")
End If
strSQL = "SELECT Count(*) AS ItemCount FROM Entries Where (ForumID = " & rs("Id") & ")"
Set recordCount = myConn.Execute(strSQL)
strHTML = strHTML & "<tr><td STYLE=""border-bottom: thin dotted #E9ECEF; border-bottom-width: 1px""><b><IMG SRC=images/pil.gif BORDER=0 WIDTH=11 HEIGHT=8 ALIGN=bottom ALT= ><a href=""forumthreads.asp?forumid=" & rs("ID") & """>" & rs("Forum") & "</a></b></td>"
strHTML = strHTML & "<td ALIGN=center STYLE=""border-bottom: thin dotted #E9ECEF; border-bottom-width: 1px"">" & recordCount("ItemCount") & "</td>"
strHTML = strHTML & "<td ALIGN=center STYLE=""border-bottom: thin dotted #E9ECEF; border-bottom-width: 1px"">" & dtmFormatDate & "</td></tr>"
rs.MoveNext
Loop
End If
myConn.Close
Set myConn = Nothing
%>
<HTML>
<HEAD>
</HEAD>
<BODY>
TABLE WIDTH="500" BORDER="0" CELLSPACING="0" CELLPADDING="1">
<TR>
<TD BGCOLOR="#FFFFFF" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1"> <B>Forums</B></TD>
<TD BGCOLOR="#FFFFFF" ALIGN="center" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1"><B>Indlæg</B></TD>
<TD BGCOLOR="#FFFFFF" ALIGN="center" STYLE="border-bottom: thin solid #AEAEB6; border-bottom-width: 1"><B>Seneste</B></TD>
</TR>
<%=strHTML%>
</TABLE>
</BODY>
</HTML>
