石城张三 - 2008-8-13 20:29:00
请高手指正!!!
发布新闻时经常碰到如下错误
=================================
发布失败,请与管理员联系。 返回
错误描述如下:
Microsoft OLE DB Provider for SQL Server 错误 '80040e14' 第 1 行: 's' 附近有语法错误。 E:\NEWS2008\ADMIN\PUBLICSITE\../../FS_InterFace/NS_Public.asp,行 1008
我查了代码,好像是相关新闻部分的,具体的看不懂,请教!
======================
'得到相关新闻
Public Function c_news(f_Lablechar,f_type,f_Id)
'c_news┆根据条件$1┆显示数量$10┆标题字数$40┆导航$·┆css$
'c_news┆根据条件$1┆显示数量$10┆标题字数$40┆引用样式$45
Dim ifstr,titleNumber,leftTitle,f_sql,rs,str_newstitle,like_str,old_rs,TitleNumberStr,style_id,MF_Domain
ifstr = split(split(f_Lablechar,"┆")(1),"$")(1)
TitleNumberStr= split(split(f_Lablechar,"┆")(2),"$")(1)
if not isnumeric(TitleNumberStr) then:TitleNumberStr = 10:else:TitleNumberStr = cint(TitleNumberStr):end if
leftTitle= split(split(f_Lablechar,"┆")(3),"$")(1)
if not isnumeric(leftTitle) then:leftTitle = 40:else:leftTitle = cint(leftTitle):end if
style_id = split(split(f_Lablechar,"┆")(4),"$")(1)
MF_Domain = Request.Cookies("FoosunMFCookies")("FoosunMFDomain")
c_news = ""
'获得原新闻关键字
dim RelateNewsSql,RsSearchObj,OldSpecialID,tmp_like,tmp_1,tmp_2
RelateNewsSql = "exec FS_NS_Public_FS_NS_News_NewsID_3 '" & f_Id & "'"
Set RsSearchObj = Conn.Execute(RelateNewsSql)
if Not RsSearchObj.Eof then
If RsSearchObj("KeyWords") <> "" and isnull(RsSearchObj("KeyWords"))=false then
Dim KeyWordsStr,KeyWordsArray,SqlKeyWordStr,keyword_j
SqlKeyWordStr = ""
KeyWordsStr = RsSearchObj("KeyWords")
If KeyWordsStr<>"" and isnull(KeyWordsStr)=false then
if instr(KeyWordsStr,",")=0 then KeyWordsStr = KeyWordsStr&","
KeyWordsArray = split(KeyWordsStr,",")
For keyword_j = 0 to UBound(KeyWordsArray)
if KeyWordsArray(keyword_j)<>"" then
if ifstr = "0" then
if G_IS_SQL_DB=0 then
If SqlKeyWordStr = "" then
SqlKeyWordStr = "instr(NewsTitle,'"&KeyWordsArray(keyword_j)&"')>0"
Else
SqlKeyWordStr = SqlKeyWordStr & "or instr(NewsTitle,'"&KeyWordsArray(keyword_j)&"')>0"
End If
else
If SqlKeyWordStr = "" then
SqlKeyWordStr = "charindex('"&KeyWordsArray(keyword_j)&"',NewsTitle)>0"
Else
SqlKeyWordStr = SqlKeyWordStr & "or charindex('"&KeyWordsArray(keyword_j)&"',NewsTitle)>0"
End If
end if
elseif ifstr = "2" then
if G_IS_SQL_DB=0 then
If SqlKeyWordStr = "" then
tmp_like = "instr(NewsTitle,'"&KeyWordsArray(keyword_j)&"')>0"
Else
tmp_like = tmp_like & "or instr(NewsTitle,'"&KeyWordsArray(keyword_j)&"')>0"
End If
else
If SqlKeyWordStr = "" then
tmp_like = "charindex('"&KeyWordsArray(keyword_j)&"',NewsTitle)>0"
Else
tmp_like = tmp_like & "or charindex('"&KeyWordsArray(keyword_j)&"',NewsTitle)>0"
End If
end if
If SqlKeyWordStr = "" then
SqlKeyWordStr = ""&tmp_like&" or KeyWords like '%"&KeyWordsArray(keyword_j)&"%' "
Else
SqlKeyWordStr = SqlKeyWordStr & " or "&tmp_like&" or KeyWords like '%"&KeyWordsArray(keyword_j)&"%' "
End If
elseif ifstr = "1" then
If SqlKeyWordStr = "" then
SqlKeyWordStr = "KeyWords like '%"&KeyWordsArray(keyword_j)&"%' "
Else
SqlKeyWordStr = SqlKeyWordStr & "or KeyWords like '%"&KeyWordsArray(keyword_j)&"%' "
End If
else
'3*s1 3==2
tmp_1 = mid(ifstr,2,2)
tmp_1 = replace(tmp_1,"==","=")
tmp_1 = replace(tmp_1,"<>","<>")
tmp_2 = mid(ifstr,4)
if not isnumeric(tmp_2) then c_news = "错误:"&tmp_2:exit for:exit function
if keyword_j = cint(tmp_2)-1 then
select case tmp_1
case "=","<>"
SqlKeyWordStr = " KeyWords "&tmp_1&"'"&KeyWordsArray(keyword_j)&"' "
case "*s"
SqlKeyWordStr = " KeyWords like '%"&KeyWordsArray(keyword_j)&"' "
case "*e"
SqlKeyWordStr = " KeyWords like '"&KeyWordsArray(keyword_j)&"'% "
case "**"
SqlKeyWordStr = " KeyWords like '%"&KeyWordsArray(keyword_j)&"'% "
end select
exit for
end if
end if
end if
Next
Else
SqlKeyWordStr = ""
End If
if SqlKeyWordStr<>"" then SqlKeyWordStr = " And ("&SqlKeyWordStr&")"
f_sql = "Select Top " & TitleNumberStr & " ID,NewsId,PopId,ClassID,SpecialEName,NewsTitle,CurtTitle,NewsNaviContent,isShowReview,TitleColor,titleBorder,TitleItalic,IsURL,URLAddress,Content,isPicNews,NewsPicFile,NewsSmallPicFile,isPop,Source,Editor,Keywords,Author,Hits,SaveNewsPath,FileName,FileExtName,NewsProperty,isLock,addtime,TodayNewsPic from FS_NS_News Where isRecyle=0 and isdraft=0 " & SqlKeyWordStr & " and islock=0 and NewsID<>'"&f_id &"' order by addtime desc,ID Desc"
'response.Write("f_sql:"&f_sql)
'response.end
Set rs = Conn.Execute(f_sql) ‘报错的1008行
if Not rs.Eof then
c_news = ""
do while Not rs.Eof
jxspace - 2008-8-13 22:09:00
你使用单个栏目发布一下呢,应该是某条新闻引起的.