Web Wiz - Green Windows Web Hosting - Celebrating 25 Years!

  New Posts New Posts RSS Feed - Latest Forum Post
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Latest Forum Post

 Post Reply Post Reply
Author
GeorgeB View Drop Down
Newbie
Newbie
Avatar

Joined: 31 May 2005
Location: Turkey
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote GeorgeB Quote  Post ReplyReply Direct Link To This Post Topic: Latest Forum Post
    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=<% = 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.
 
Back to Top
dfrancis View Drop Down
Senior Member
Senior Member


Joined: 16 March 2005
Location: United States
Status: Offline
Points: 442
Post Options Post Options   Thanks (0) Thanks(0)   Quote dfrancis Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
GeorgeB View Drop Down
Newbie
Newbie
Avatar

Joined: 31 May 2005
Location: Turkey
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote GeorgeB Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 31 May 2005 at 3:44pm
you may have to set the charector encoding to turkish charecters
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.