Kan ikke sætte to koder sammen :-(
Hej,Håber virkelig nogen kan hjælp mig fordi nu har jeg næsten brugt hele dagen på det uden resultat. Jeg kan ikke få sat to forskellige koder sammen.
Jeg har denne som laver kl. om hvis den er 1 eller 2 dage gammel. I må gerne lave koden om hvis det hjælper...
function lavDato(datoTid)
datoDB = FormatDateTime(datoTid,2)
if CStr(datoDB) = Cstr(Date) then
str = "kl. " & FormatDateTime(datoTid,4)
elseif CStr(datoDB) = CStr(DateAdd("d", -1, Date)) then
str = "Igår kl. " & FormatDateTime(datoTid,4)
else
str = FormatDateTime(datoTid,2) & " " & FormatDateTime(datoTid,4)
end if
lavDato = str
end function
Den skal jeg så have sat ind i nedenstående kode.
<%
Set myConn = Server.CreateObject("ADODB.Connection")
myConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("demo.mdb"))
strSQL = "SELECT * FROM Forums Where mygroup='" & ("CAD Systemer") & "'"
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") & " " & formatDate("FormTime")
End If
strSQL = "SELECT Count(*) AS ItemCount FROM Entries Where (ForumID = " & rs("Id") & ")"
Set recordCount = myConn.Execute(strSQL)
response.write "<TR><TD STYLE=""border-bottom: 1px dotted #E2E2E2;""><IMG SRC=""../images/pilmap.gif"" BORDER=""0"" WIDTH=""15"" HEIGHT=""12"" ALIGN=""bottom"" ALT=""""><a href=""kategori.asp?forumid=" & rs("ID") & """>" & rs("Forum") & "</a></TD>"
response.write "<TD ALIGN=""center"" STYLE=""border-bottom: 1px dotted #E2E2E2;"">" & recordCount("ItemCount") & "</TD>"
response.write "<TD ALIGN=""center"" STYLE=""border-bottom: 1px dotted #E2E2E2;"">" & dtmFormatDate & "</TD></TR>"
rs.MoveNext
Loop
End if
myConn.Close
Set myConn = Nothing
%>
