#12004/6/9 8:30:34
各位大虾。帮我看看这是那里出问题了。谢谢!
Microsoft OLE DB Provider for SQL Server 错误 '80040e14'
在关键字 'like' 附近有语法错误。
/modules/news/main.asp,行193
<!--#include virtual="/modules/news/sontopic.asp"-->
<%
sub newslist(flag,topicid,nu,md)
'flag 查询字段
'topicid 查询条件
'nu 显示记录数,0表示不限
'md 显示模式,1为小块显示,2为大块显示,3为两行显示
'网站最新新闻为 newslist "'0'",0,5,1
dim pages,page,allpages,topic,iLine,i
set conn=dbconn()
if topicid=0 then
sql="select name,isuse from topic"
else
sql="select name,isuse from topic where id='"&topicid&"'"
end if
set rs=dbrs(conn,sql)
if not rs.eof then
topic=rs("name")
if rs("isuse")<>true then
son topicid
else
redim sontopic(0)
end if
end if
rs.close
set rs=nothing
Set rs=Server.Createobject("ADODB.RECORDSET")
sql="select "
if nu<>0 then
sql=sql&"top "&nu&" "
end if
sql=sql&"id,name,Sticky,ptopic,color,linkout from news where show=1 and "
if uBound(sontopic,1)=0 then
sql=sql&flag&"='"&topicid&"' order by Sticky desc,id desc"
else
for i=1 to topicnu-1
sql=sql&flag&"='"&sontopic(i)&"' or "
next
sql=sql&flag&"='"&sontopic(topicnu)&"' order by id desc"
redim sontopic(0)
topicnu=0
end if
rs.open sql,conn,1,1
if md=1 then
if not rs.eof then
while not rs.eof
response.write(" <img src=""/theme/net01/img/arrow.gif""> ")
if rs("linkout")<>"" then
response.write("<a href="""&rs("linkout")&""" target=""_blank"">")
else
response.write("<a href=""/modules/news/show.asp?id="&rs("id")&""">")
end if
if rs("Sticky")=true then
response.write("<font color=""#ff3300"">"&rs("name")&"</font></a>")
else
if rs("color")<>"" then
response.write("<font color="&rs("color")&">"&rs("name")&"</font></a>")
else
response.write(rs("name")&"</a>")
end if
end if
response.write("<br>")
pages = pages - 1
rs.movenext
wend
else
Response.Write("数据库暂无内容!")
End if
elseif md=2 then
if rs.RecordCount=1 then
if rs("ptopic")=0 then
response.redirect"/modules/news/show.asp?id="&rs("id")
end if
end if
CreateTopTable topic,"<table width=""100%""><tr><td>"&topic&"</td><td align=right><a href=""/modules/news/list.asp?topicid="&topicid&""">more</a></td></tr></table>","listTitle"
if not rs.eof then
pages = 30 '定义每页显示的记录数
rs.pageSize = pages '定义每页显示的记录数
allPages = rs.pageCount'计算一共能分多少页
page = Request.QueryString("page")'通过浏览器传递的页数
'if语句属于基本的排错处理
if isEmpty(page) or Cint(page) < 1 then
page = 1
elseif Cint(page) > allPages then
page = allPages
end if
rs.AbsolutePage = page
iline=1
while not rs.eof and pages > 0
response.write("<tr ><td class=""tableline" & iLine & """> <img src=""/theme/net01/img/arrow.gif""> ")
response.write("<a href=""/modules/news/show.asp?id="&rs("id")&""">"&rs("name")&"</a>")
response.write("</td></tr>")
pages = pages - 1
if iline=1 then
iline=2
elseif iline=2 then
iline=1
end if
rs.movenext
wend
response.write("<tr><td>")
call pagei("list.asp?topicid="&topicid,allpages,page)
response.write("</td></tr>")
else
Response.Write("数据库暂无内容!")
End if
CreateBottomTable ""
elseif md=3 then
i=1
if not rs.eof then
response.write("<table width=""100%"">")
while not rs.eof
if i=1 then
response.write("<tr><td> <img src=""/theme/net01/img/arrow.gif""> ")
response.write("<a href=""/modules/news/show.asp?id="&rs("id")&""">")
if rs("Sticky")=true then
response.write("<font color=""#ff3300"">"&rs("name")&"</font></a>")
else
response.write(rs("name")&"</a>")
end if
response.write("</td>")
pages = pages - 1
i=2
elseif i=2 then
response.write("<td> <img src=""/theme/net01/img/arrow.gif""> ")
response.write("<a href=""/modules/news/show.asp?id="&rs("id")&""">")
if rs("Sticky")=true then
response.write("<font color=""#ff3300"">"&rs("name")&"</font></a>")
else
response.write(rs("name")&"</a>")
end if
response.write("</td></tr>")
pages = pages - 1
i=1
end if
rs.movenext
wend
response.write("</table>")
else
Response.Write("数据库暂无内容!")
End if
end if
conn.close
set rs=nothing
set conn=nothing
end sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
%>
<% SUB pagei(pUrl,allpages,page)
Dim eUrl,txts,i,txt
if allpages>1 then
For i =1 to allpages
if i mod 18=0 then
txt="<br>"
txt = txt&"<strong>"
txt = txt & "<a href="&pUrl&"&page="&i&">"
if i = Cint(Page) then txt = txt & "<font color='bb0000'>"
txt = txt & (i)
if i = Cint(Page) then txt = txt & "</font>"
txt = txt & "</a> </strong>"
else
txt ="<strong>"
txt = txt & "<a href="&pUrl&"&page="&i&">"
if i = Cint(Page) then txt = txt & "<font color='bb0000'>"
txt = txt & (i)
if i = Cint(Page) then txt = txt & "</font>"
txt = txt & "</a> </strong>"
end if
Response.Write(txt)
Next
end if
END sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
%>
<%sub seclist(key,searchby,flag1,flag2,flag3,flag4)
dim page,allpages,pages
dim iLine
set conn=dbconn()
Set rs=Server.Createobject("ADODB.RECORDSET")
sql="select news.id,news.name as newsname,topic.name from news,topic where news."&searchby&" like '%"&key&"%' and news.topic=topic.id"
rs.open sql,conn,1,1
CreateTopTable "search","搜索结果-关键字["&key&"]","listTitle"
if not rs.eof then
pages=30
rs.pageSize = pages '定义每页显示的记录数
allPages = rs.pageCount'计算一共能分多少页
page = Request.QueryString("page")'通过浏览器传递的页数
'if语句属于基本的排错处理
if isEmpty(page) or Cint(page) < 1 then
page = 1
elseif Cint(page) > allPages then
page = allPages
end if
rs.AbsolutePage = page
iline=1
while not rs.eof and pages > 0
response.write("<tr ><td class=""tableline" & iLine & """> <img src=""/theme/net01/img/arrow.gif""> ")
response.write("<a href=""/modules/news/show.asp?id="&rs("id")&""">"&rs("newsname")&"</a> ["&rs("name")&"]")
response.write("</td></tr>")
pages = pages - 1
if iline=1 then
iline=2
elseif iline=2 then
iline=1
end if
rs.movenext
wend
response.write("<tr><td>")
call pagei(sURLPage&"?key="&key,allpages,page)
response.write("</td></tr>")
else
Response.Write("数据库暂无内容!")
End if
CreateBottomTable ""
rs.close
set rs=nothing
conn.close
set conn=nothing
end sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
%>
<%
sub keylist(flag,keywords,nu,md)
'flag 查询字段
'topicid 查询条件
'nu 显示记录数,0表示不限
'md 显示模式,1为小块显示,2为大块显示,3为两行显示
dim pages,page,allpages,topic,iLine,i
Set rs=Server.Createobject("ADODB.RECORDSET")
sql="select "
sql=sql&"top 5 "
sql=sql&"id,name,ptopic from news where ("
for i=0 to UBound(keywords)
sql=sql&flag&" like '%"&keywords(i)&"%' or "
next
sql=sql&"1=0) and show='1' and id<>'"&request("id")&"' order by id desc"
'response.write sql
rs.open sql,conn,1,1
if md=1 then
if not rs.eof then
while not rs.eof
response.write(" <img src=""/theme/net01/img/arrow.gif""> ")
response.write("<a href=""/modules/news/show.asp?id="&rs("id")&""">")
response.write(rs("name")&"</a>")
response.write("<br>")
'pages = pages - 1
rs.movenext
wend
else
Response.Write("尚无相关内容!")
End if
end if
end sub
%>