Print Page | Close Window

Latest Forum Post

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums
Forum Description: Support forum for Web Wiz Forums application.
URL: https://forums.webwiz.net/forum_posts.asp?TID=15297
Printed Date: 13 April 2026 at 5:14am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Latest Forum Post
Posted By: GeorgeB
Subject: Latest Forum Post
Date Posted: 31 May 2005 at 5:16am
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) & "...&nbsp;"
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">&nbsp;
<a href=" http://www.your_homepage_here/forum/forum_posts.asp?TID=<% - 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 %>&nbsp; <% = 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.
 



Replies:
Posted By: dfrancis
Date Posted: 31 May 2005 at 10:20am
Try commenting out these parts... and see if it works.
 
'Set rsLastestPosts = Nothing
'adoCon.Close
'Set adoCon = Nothing
'Set strCon = Nothing
%>
 
If it works then look at when/where you can close the objects better.
 
At least that's what I would do. Embarrassed


Posted By: GeorgeB
Date Posted: 31 May 2005 at 1:56pm
Thank you. Working fine.
 
i have included the page to my default.asp. but i can not see turkish characters correctly. is there any code to correct this? thanks.


Posted By: dj air
Date Posted: 31 May 2005 at 3:44pm
you may have to set the charector encoding to turkish charecters



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net