asp database idea - Posted (1570 Views)
Starting Member
elmo
Posts: 14
14
www.vex-clan.co.uk

this is site i want to do it. basiclly never used asp before. but what i want to do i grab the lastest post from a part of the forum i want and have it display on front page of my site.

involuing asp going to database and the database getting the post i want.
Can anyone help me code this or direct me to something that can help. thanks<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Member Locked
alanh
Posts: 92
92
Here is a link to the error code you are getting, that may help.
It looks like you are not looking at or getting to the correct database, i.e. the DSN is not set correctly.<
Posted
Starting Member
SnapperL
Posts: 24
24
Anyone have any idea why I might be getting this error on slash mod?
Code:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14' 

[MySQL][ODBC 3.51 Driver][mysqld-4.0.27-max-log]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '5 FORUM_TOPICS.TOPIC_ID, FORUM_TOPICS.T_SUBJECT, FORUM_TOPICS.T

/forum/inc_simple_slash.asp, line 38
<
This account was hacked into by Image, a very honest guy as you all can see! Stealing people's passwords is his pasttime. Beware of this, before you register at his forums!
Posted
Forum Moderator
AnonJr
Posts: 5768
5768
Because as it is "out of the box" it uses the MS SQL Server/Access syntax. MySQL uses LIMIT instead of TOP (and the limit goes at the end.)

Take a look at the copy I posted earlier and you'll see one of the ways to fix it.<
Posted
Average Member
cripto9t
Posts: 881
881
Code:
strSql = "SELECT "
strSql = strSql & "T.TOPIC_ID, "
strSql = strSql & "T.T_SUBJECT, "
strSql = strSql & "T.T_MESSAGE, "
strSql = strSql & "T.T_DATE, "
strSql = strSql & "T.T_AUTHOR, "
strSql = strSql & "M.MEMBER_ID, "
strSql = strSql & "M.M_NAME "
strSql = strSql & " FROM ((" & strTablePrefix & "FORUM F "
strSql = strSql & "INNER JOIN " & strTablePrefix & "TOPICS T ON "
strSql = strSql & "F.FORUM_ID = T.FORUM_ID) "
strSql = strSql & "INNER JOIN " & strTablePrefix & "MEMBERS M ON "
strSql = strSql & "T.T_AUTHOR = M.MEMBER_ID) "
'I added the "F.F_PRIVATEFORUMS = 0" so that private forums wouldn't be displaid
If SlashForumID <> "ANY" Then
strSql = strSql & " WHERE T.FORUM_ID = " & SlashForumID & " AND F.F_PRIVATEFORUMS = 0"
Else
strSql = strSql & " WHERE F.F_PRIVATEFORUMS = 0"
End If
strSql = strSql & " AND T.FORUM_ID <> " & intFPTestForum
strSql = strSql & " AND T.FORUM_ID <> " & intFPNewsForum
strSql = strSql & " ORDER BY T.T_DATE DESC"

Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnString
Set objRS = objConn.Execute(TopSql(strSQL,SlashCount))
Use the TopSql() function. The red code above shows how to use it. The function is in forum file "inc_func_common"

I used AnonJrs' code here so dont copy and paste. Just use the first and last lines. <
    _-/Cripto9t\-_
Posted
Starting Member
SnapperL
Posts: 24
24
ok now I'm getting this error.....
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 3.51 Driver][mysqld-4.0.27-max-log]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

/forum/simple_slash.asp, line 38
<
This account was hacked into by Image, a very honest guy as you all can see! Stealing people's passwords is his pasttime. Beware of this, before you register at his forums!
Posted
Average Member
modifichicci
Posts: 787
787
Where have you set SlashForumID and SlashCount? Because file use these variables:
Const intTopicCount = 1
Const ForumID = 13
Const CharsToDisplay = 220
and I don't see yours...<
Posted
Starting Member
SnapperL
Posts: 24
24
here is the top of my file....
<!--#include file="config.asp"-->
<!--#include file="inc_func_common.asp" -->
<%
'---------------------------------------------------
' Gremlins Simple Slash MOD
' Simply displays the last intTopicCount topics
' From ForumID (Use ForumID = "ANY" for all Forums)
'---------------------------------------------------

Const intTopicCount = 5
Const ForumID = 19
Const CharsToDisplay = 200

'------------
' Get Topics
'------------
strSql = "SELECT "
strSql = strSql & strTablePrefix & "TOPICS.TOPIC_ID, "
strSql = strSql & strTablePrefix & "TOPICS.T_SUBJECT, "
strSql = strSql & strTablePrefix & "TOPICS.T_MESSAGE, "
strSql = strSql & strTablePrefix & "TOPICS.T_DATE, "
strSql = strSql & strTablePrefix & "TOPICS.T_AUTHOR, "
strSql = strSql & strTablePrefix & "MEMBERS.MEMBER_ID, "
strSql = strSql & strTablePrefix & "MEMBERS.M_NAME "
strSql = strSql & " FROM ((" & strTablePrefix & "FORUM "
strSql = strSql & "INNER JOIN " & strTablePrefix & "TOPICS ON "
strSql = strSql & strTablePrefix & "FORUM.FORUM_ID = "
strSql = strSql & strTablePrefix & "TOPICS.FORUM_ID) "
strSql = strSql & "INNER JOIN " & strTablePrefix & "MEMBERS ON "
strSql = strSql & strTablePrefix & "TOPICS.T_AUTHOR = "
strSql = strSql & strTablePrefix & "MEMBERS.MEMBER_ID) "
If ForumID <> "ANY" Then strSql = strSql & " WHERE " & strTablePrefix & "TOPICS.FORUM_ID = " & ForumID
strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_DATE DESC "

Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnString
Set objRS = objConn.Execute(TopSql(strSQL,SlashCount))
<
This account was hacked into by Image, a very honest guy as you all can see! Stealing people's passwords is his pasttime. Beware of this, before you register at his forums!
Posted
Average Member
modifichicci
Posts: 787
787
Set objRS = objConn.Execute(TopSql(strSQL,SlashCount))
change SlashCount with intTopicCount<
Posted
Starting Member
SnapperL
Posts: 24
24
that did the trick, can't believe I didn't see that
Thanks guys....<
This account was hacked into by Image, a very honest guy as you all can see! Stealing people's passwords is his pasttime. Beware of this, before you register at his forums!
You Must enter a message