I use this, not sure if the its all up to scratch ASP wise but it seems to work for me
<!--#INCLUDE FILE="forum/config.asp" -->
<!--#INCLUDE FILE="forum/inc_functions.asp" -->
<%
Dim sQLQuery
Dim count
count = "0"
sQLQuery = "select FORUM_TOPICS.TOPIC_ID, FORUM_TOPICS.T_SUBJECT, FORUM_TOPICS.T_MESSAGE," & _
" FORUM_TOPICS.T_DATE from FORUM_TOPICS" & _
" ORDER BY FORUM_TOPICS.TOPIC_ID DESC;"
Set dataConn = Server.CreateObject("ADODB.Connection")
dataConn.Open strConnString
Set RSlist = Server.CreateObject("ADODB.recordset")
Rslist.Open sqlQuery, dataConn
Do While Not RSlist.EOF AND count < "5"
response.write "<a href=""forum/topic.asp?TOPIC_ID=" & RSlist("TOPIC_ID") & " "" " & " class=""pageLinks"" > Subject : " & VBNewline & _
RSlist("T_SUBJECT") & "</a><BR>" & VBNewline
response.write "<span class=""textPost""> " & Trim(Left(RemoveHTML(RSlist("T_MESSAGE")), 50)) & "....</span>" & "<BR>" & VBNewline
response.write "<span class=""textSmallMoreover"">Posted : " & StrToDate(RSlist("T_DATE")) & "</span><BR>" & VBNewline
'increment count
count = count + 1
RSlist.Movenext
Loop
%>
Also add this to include functions if you are going to use it.
Function RemoveHTML( strText )
Dim nPos1
Dim nPos2
nPos1 = InStr(strText, "<")
Do While nPos1 > 0
nPos2 = InStr(nPos1 + 1, strText, ">")
If nPos2 > 0 Then
strText = Left(strText, nPos1 - 1) & Mid(strText, nPos2 + 1)
Else
Exit Do
End If
nPos1 = InStr(strText, "<")
Loop
RemoveHTML = strText
End Function
.::Hamlin::.
The Arsenal!
In the time of chimpanzees I was a monkey
I was also an insomniac
EDIT - I think i've seen a mistake in my code , and your will have to remove the <span class="...> stuff if you use it.
Edited by - Hamlin on 17 June 2002 16:26:31