Hi all,
I'm using the code below to show latest forum post.
<%
Dim rsLastestPosts
Dim strPosts
Dim adoCon
Dim strCon
Dim strSQL
'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Database connection info and driver
strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=; DBQ=" & Server.MapPath("../../database/wwForum.mdb")
'Set an active connection to the Connection object
adoCon.Open strCon
Set rsLastestPosts = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblAuthor.Username, tblAuthor.Author_ID, tblTopic.Topic_ID, tblTopic.Subject, tblForum.Forum_ID, tblForum.[Read] "
strSQL = strSQL & "FROM tblForum INNER JOIN tblTopic ON tblForum.Forum_ID = tblTopic.Forum_ID "
strSQL = strSQL & "WHERE ((tblForum.Password) Is Null) "
strSQL = strSQL & "ORDER BY tblTopic.Last_entry_date DESC;"
strSQL = "SELECT TOP 10 tblTopic.Topic_ID, tblTopic.Subject, tblForum.Forum_ID, tblForum.Forum_name, tblTopic.Last_entry_date, Count(tblThread.Thread_ID) AS CountOfThread_ID, Last(tblAuthor.Username) AS LastOfUsername, tblForum.[Read]"
strSQL = strSQL & " FROM (tblForum INNER JOIN tblTopic ON tblForum.Forum_ID = tblTopic.Forum_ID) INNER JOIN (tblAuthor INNER JOIN tblThread ON tblAuthor.Author_ID = tblThread.Author_ID) ON tblTopic.Topic_ID = tblThread.Topic_ID"
strSQL = strSQL & " WHERE (((tblForum.Password) Is Null))"
strSQL = strSQL & " GROUP BY tblTopic.Topic_ID, tblTopic.Subject, tblForum.Forum_ID, tblForum.Forum_name, tblTopic.Last_entry_date, tblForum.[Read]"
strSQL = strSQL & " ORDER BY tblTopic.Last_entry_date DESC;"
rsLatestPosts.Open strSQL, adoCon
rsLastestPosts.Open strSQL, strCon
If rsLastestPosts.EOF Then Response.Write strTxtIngenNyPostPaStartsidan
Do while NOT rsLastestPosts.EOF
If len(rsLastestPosts("Subject"))>100 then
strPosts = left(rsLastestPosts("Subject"),50) & "... "
Else
strPosts = rsLastestPosts("Subject")
LastOfUsername = rsLastestPosts("LastOfUsername")
End If
%>
<tr><td bgcolor="#faf9f7" class="menuCell" onmouseover="this.className='menuCellOn';" onmouseout="this.className='menuCell';" noWrap width="65%" bgColor="#faf9f7" height="20">
<a href="
http://www.your_homepage_here/forum/forum_posts.asp?TID=<% = rsLastestPosts("Topic_ID") %>" target="_self"><span style="text-decoration: none"><% = strPosts %></a></td>
<td class="text" align="left"><font size="1"><% = strTxtTioSenasteForumTradarnaPaStartSidan %> <% = rsLastestPosts("LastOfUsername") %><br>
<%
rsLastestPosts.MoveNext
Loop
rsLastestPosts.Close
Set rsLastestPosts = Nothing
adoCon.Close
Set adoCon = Nothing
Set strCon = Nothing
%>
I'm receiving this error:
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'rsLatestPosts'
forum/new_posts.asp, line 29
Thank you.