日期:2014-05-17  浏览次数:20830 次

如何设置参数?
PicFile字段存储的是文章的图片路径,现在要设置一个“有图片”链接,当点击这个链接的时候把所有有图片的文章列出来。 article_list.asp中相关代码。
<%
stype = Trim(Request.QueryString("stype"))
keyword = Trim(Request.QueryString("keyword"))
ClassID = Trim(Request.QueryString("ClassID"))
IsPass = Trim(Request.QueryString("IsPass"))
IsPic = Trim(Request.QueryString("IsPic"))
IsTop = Trim(Request.QueryString("IsTop"))
IsCommend = Trim(Request.QueryString("IsCommend"))
IsMove = Trim(Request.QueryString("IsMove"))
IsPlay = Trim(Request.QueryString("IsPlay"))
IsIndexImg = Trim(Request.QueryString("IsIndexImg"))
PicFile= Trim(Request.QueryString("PicFile"))
Sql = "select * from Ok3w_Article where ChannelID=" & ChannelID & " and IsDelete=" & IsDelete

If keyword<>"" Then Sql = Sql & " and " & stype & " like '%" & keyword & "%'"
If ClassID<>"" Then
ClassID = Cdbl(ClassID)
Sql = Sql & " and SortPath like '%," & ClassID & ",%'"
End If
If IsPass<>"" Then Sql = Sql & " and IsPass=" & Cint(IsPass)
If IsPic<>"" Then Sql = Sql & " and IsPic=" & Cint(IsPic)
If IsTop<>"" Then Sql = Sql & " and IsTop=" & Cint(IsTop)
If IsCommend<>"" Then Sql = Sql & " and IsCommend=" & Cint(IsCommend)
If IsMove<>"" Then Sql = Sql & " and IsMove=" & Cint(IsMove)
If IsPlay<>"" Then Sql = Sql & " and IsPlay=" & Cint(IsPlay)
If IsIndexImg<>"" Then Sql = Sql & " and IsIndexImg=" & Cint(IsIndexImg)
If PicFile<>"" Then Sql = Sql & " and PicFile="&Cint(PicFile)
If IsUserAdd<>"" Then Sql = Sql & " and IsUserAdd=" & Cint(IsUserAdd)

Sql = Sql & " order by Id desc"
Set Page = New TurnPage
Call Page.GetRs(Conn,Rs,Sql,20)
%>

<a href="?ChannelID=<%=ChannelID%>">全部</a> <a href="?ChannelID=<%=ChannelID%>&IsPass=0">待审</a> <a href="?ChannelID=<%=ChannelID%>&IsTop=1">置顶</a> <a href="?ChannelID=<%=ChannelID%>&IsCommend=1">推荐</a> <a href="?ChannelID=<%=ChannelID%>&IsPic=1">图片</a> <a href="?ChannelID=<%=ChannelID%>&IsMove=1">滚动</a> <a href="?ChannelID=<%=ChannelID%>&IsPlay=1">轮播</a> <a href="?ChannelID=<%=ChannelID%>&IsIndexImg=1">略图</a> <a href="?ChannelID=<%=ChannelID%>&PicFile=1">有图片</a></td>
 

------解决方案--------------------
If PicFile<>"" Then Sql = Sql & " and PicFile="&Cint(PicFile)改为

If Cint(PicFile)=1 Then 
Sql = Sql & " and (PicFile is not null and PicFile<>'')"
end if
------解决方案--------------------
探讨

引用:
If PicFile<>"" Then Sql = Sql &amp;amp; " and PicFile="&amp;amp;Cint(PicFile)改为

If Cint(PicFile)=1 Then
Sql = Sql &amp;amp; " and (PicFile is not null and PicFile<>'')"
……