This is the error I am getting:
Microsoft OLE DB Provider for SQL Server error '80040e14'
Invalid column name 'Last_entry_date'.
/test.asp, line 288
|
Here is my code:
[quote]
<%
'//----------------------------------------------------------
'// Declare variables
'//----------------------------------------------------------
Dim rsLastestPostsMod
Dim adoLastestPostsModCon
Dim strLastestPostsModCon
Dim strSQLLastsPostsMod
Dim strLastestPostsModTopicSubject
Dim strLastestPostsModForumPath
Dim intLastestPostsTotal
Dim intHowManyChars
'The path to the forum
'How many new topics to show
intLastestPostsTotal = 10
'How many characters should be showed before the subject is cut off
intHowManyChars = 22
'//----------------------------------------------------------
'//----------------------------------------------------------
'// Database connection
'//----------------------------------------------------------
'Default connection
'strLastestPostsModCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/wwforum.mdb")
'Uncomment for a full phsyical path. Then change the path
'strLastestPostsModCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\Inetpub\wwwroot\iportalx\iPortalX\_private\portal.mdb"
'Uncomment for a DSN connection
'strLastestPostsModCon = "DSN=DSN_NAME"
'MSSQL Connection
Const strSQLServerName = "localhost"
Const strSQLDBUserName = "sa"
Const strSQLDBPassword = "hunter1"
Const strSQLDBName = "mmaforum"
'Uncomment for MSSQL connection. Make sure to enter MSSQL DB Info above!
'The SQLOLEDB driver offers the highest performance at this time for connecting to SQL Server databases from within ASP.
strLastestPostsModCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";"
'//----------------------------------------------------------
'//----------------------------------------------------------
'// Opens the connection
'//----------------------------------------------------------
Set adoLastestPostsModCon = Server.CreateObject("ADODB.Connection")
adoLastestPostsModCon.Open strLastestPostsModCon
'//----------------------------------------------------------
'//----------------------------------------------------------
'// Opens the recordset for getting the records
'//----------------------------------------------------------
Set rsLastestPostsMod = Server.CreateObject("ADODB.Recordset")
'SQL that checks for permissions so it doesnt show senstive topics
strSQLLastsPostsMod = "SELECT TOP 15 tblThread.Topic_ID, tblThread.Thread_ID, tblThread.Author_ID, tblTopic.Subject, tblTopic.Priority, tblTopic.Locked, tblTopic.Moved_ID, tblTopic.Poll_ID, tblTopic.Last_entry_date, tblTopic.No_of_views, tblForum.Forum_ID, tblForum.Forum_name, tblAuthor.Username " & _
"FROM tblAuthor INNER JOIN (tblForum INNER JOIN (tblTopic INNER JOIN tblThread ON tblTopic.Last_entry_date = tblThread.Message_date) ON tblForum.Forum_ID = tblTopic.Forum_ID) ON tblAuthor.Author_ID = tblThread.Author_ID " & _
"WHERE (tblForum.[Read] <= 1 OR (tblTopic.Forum_ID IN (" & _
" SELECT tblPermissions.Forum_ID " & _
" FROM tblPermissions " & _
" WHERE tblPermissions.Author_ID=1 OR tblPermissions.Group_ID = 2 AND tblPermissions.[Read]=1))" & _
" )" & _
" " & _
"AND tblTopic.Topic_ID = tblThread.Topic_ID ORDER BY tblTopic.Last_entry_date DESC;"
rsLastestPostsMod.Open strSQLLastsPostsMod, adoLastestPostsModCon
'//----------------------------------------------------------
'//----------------------------------------------------------
'// Loop through the records if any
'//----------------------------------------------------------
If rsLastestPostsMod.EOF Then
Response.Write "<span class=""smltext"">No Forum Posts Made</span>"
Else
Do while NOT rsLastestPostsMod.EOF
If len(rsLastestPostsMod("Subject")) > intHowManyChars then
strLastestPostsModTopicSubject = left(decodeString(rsLastestPostsMod("Subject")),intHowManyChars) & "... "
Else
strLastestPostsModTopicSubject = rsLastestPostsMod("Subject")
End If
Response.Write("- <a href=""" & strLastestPostsModForumPath & "forum_posts.asp?TID=" & rsLastestPostsMod("Topic_ID") & "&PN=1"">" & strLastestPostsModTopicSubject & "</a>")
rsLastestPostsMod.MoveNext
If NOT rsLastestPostsMod.EOF Then Response.Write("<br>")
Loop
End If
'//----------------------------------------------------------
'//----------------------------------------------------------
'// Reset Server Objects
'//----------------------------------------------------------
rsLastestPostsMod.Close
Set rsLastestPostsMod = Nothing
adoLastestPostsModCon.Close
Set adoLastestPostsModCon = Nothing
'//----------------------------------------------------------
'*********************************************
'*** Decode HTML encoding *****
'*********************************************
'Decode encoded strings
Private Function decodeString(ByVal strInputEntry)
'Decode HTML character entities
strInputEntry = Replace(strInputEntry, "a", "a", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "b", "b", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "c", "c", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "d", "d", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "e", "e", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "f", "f", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "g", "g", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "h", "h", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "i", "i", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "j", "j", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "k", "k", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "l", "l", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "m", "m", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "n", "n", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "