Home All Groups Group Topic Archive Search About
Author
4 Oct 2006 4:49 PM
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

%>

Author
4 Oct 2006 4:55 PM
McKirahan
<pcd***@gmail.com> wrote in message
Show quoteHide quote
news:1159980588.649811.194190@c28g2000cwb.googlegroups.com...
> 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
Are all your drivers up to date? click for free checkup

Author
4 Oct 2006 5:04 PM
McKirahan
"McKirahan" <N***@McKirahan.com> wrote in message
news:xaudnQQa5fnrer7YnZ2dnUVZ_vSdnZ2d@comcast.com...
> You didn't tell us what database and version your using!

Sorry, didn't see the ".mdb" as it was after DESCENDING...
Author
4 Oct 2006 8:00 PM
pcdr32
McKirahan wrote:
> "McKirahan" <N***@McKirahan.com> wrote in message
> news:xaudnQQa5fnrer7YnZ2dnUVZ_vSdnZ2d@comcast.com...
> > You didn't tell us what database and version your using!
>
> Sorry, didn't see the ".mdb" as it was after DESCENDING...



Thanks DESC fixed it!
Author
4 Oct 2006 5:00 PM
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?





Show quoteHide quote
> strSQL = "Select * From Sermons Order By SermonDate DESCENDING"

Bookmark and Share