在关键字 'order' 附近有语法错误

来源:百度知道 编辑:UC知道 时间:2024/07/01 04:45:42
<%
sql="select P.PhotoID,P.ClassID,P.PhotoName,C.CommentID,C.UserName,C.IP, C.Content,C.WriteTime,C.ReplyName,C.ReplyContent,C.ReplyTime,C.Email,C.Oicq,C.Homepage,C.Icq,C.Msn,C.UserType,C.Score from PhotoComment C Left Join Photo P On C.PhotoID=P.PhotoID where 1 "
if SearchContent<>"" then
sql=sql & " and C.Content like '%" & SearchContent & "%' "
end if
if ShowPhotoID<>"" then
sql=sql & " and C.PhotoID=" & ShowPhotoID & " "
end if
sql=sql & " order by P.PhotoID desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>

Microsoft OLE DB Provider for SQL Server (0x80040E14)
在关键字 'order' 附近有语法错误

access转sql server后出现的错误,麻烦大家看看~~~谢谢
还有一个页面
<%
sqlPath="select * From [PhotoClass] where ClassID in "& strParentPath & " order by De

sql=sql & " and C.PhotoID=" & ShowPhotoID & " "

改成

sql=sql & " and C.PhotoID=" & val(ShowPhotoID) & " "

<%
sqlPath="select * From [PhotoClass] where ClassID in "& strParentPath & " order by Depth desc"
%>

要修改为:

<%
sqlPath="select * From [PhotoClass] where ClassID in ("& strParentPath & ") order by Depth desc"
%>