Jet Database Error

P

pcdr32

Here is the message I get when I clink on the link. I did write the
code so I'm not sure what got deleted. Please Help!

ERROR:


Click on the sermon title to view it, or click the edit link to edit
the content, or the delete link to delete the sermon.



Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'SermonDate
DESCENDING'.

/sermonlist.asp, line 37



CODE:


<%
Option Explicit
Response.Buffer = True

If Session("User") = "" then
Session("FromPage") = "sermonlist.asp"
Response.Redirect("Login.asp")
End If


dim cn, cmd, rs, DataPath, strSQL, TxtClr


Response.Write("<html><head><title>Sermons</title></head><body><br><br>")
Response.Write("<center>Click on the sermon title to view it, or click
the edit link to edit the content, or the delete link to delete the
sermon.</center><br><br>")

DataPath = Server.MapPath("Calvary.mdb")

DataPath = Replace(DataPath, "wwwroot", "Database")
DataPath = Replace(DataPath, "\", "/")


set cn = CreateObject("ADODB.Connection")
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.ConnectionTimeout = 40
cn.Open DataPath

set cmd = CreateObject("ADODB.Command")
cmd.ActiveConnection = cn

set rs = CreateObject("ADODB.RecordSet")

strSQL = "Select * From Sermons Order By SermonDate DESCENDING"

cmd.CommandText = strSQL

set rs = cmd.execute
Response.Write("<table cellspacing='2' cellpadding = '3' align =
'center'>")
Response.Write("<tr><th>Sermon Title</th><th>Sermon Date</th><th>Pastor
Name</th><th>Edit</th><th>Delete</th></tr>")

TxtClr = "#FFFFFF"

Do While (Not rs.eof)

If TxtClr = "#FFFFFF" Then
TxtClr = "#CCCCCC"
Else
TxtClr = "#FFFFFF"
End If

Response.Write("<tr bgcolor = " & TxtClr & "><td><a
href='view.asp?Name=" & Server.urlencode(rs("SermonTitle")) & "'>" &
rs("SermonTitle") & "</a></td> ")
Response.Write("<td>" & rs("SermonDate") & "</td>")
Response.Write("<td>" & rs("PastorName") & "</td>")
Response.Write("<td><a href='edit_sermon.asp?Name=" &
server.urlencode(rs("SermonTitle")) & "'>Edit</a></td>")
Response.Write("<td><a href='delete.asp?Name=" & server.urlencode(
rs("SermonTitle")) & "'>Delete</a></td></tr>")
rs.MoveNext
Loop

Response.Write("</table></body></html>")

rs.close
set rs = nothing
set cmd = nothing
cn.close
set cn = nothing

%>
 
M

McKirahan

Here is the message I get when I clink on the link. I did write the
code so I'm not sure what got deleted. Please Help!

ERROR:


Click on the sermon title to view it, or click the edit link to edit
the content, or the delete link to delete the sermon.



Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'SermonDate
DESCENDING'.

/sermonlist.asp, line 37

[snip]

You didn't tell us what database and version your using!

However, try changing "DESCENDING" to "DESC".

SQL ORDER BY
http://www.w3schools.com/sql/sql_orderby.asp
 
A

Aaron Bertrand [SQL Server MVP]

Try ORDER BY SermonDate DESC ... sounds like JET doesn't like the full word.

Neither does SQL Server, by the way:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'DESCENDING'.

Where did you find documentation that DESCENDING was a valid operator?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,787
Messages
2,569,630
Members
45,334
Latest member
66Zeinab9

Latest Threads

Top