数据库提取问题?为什么根据SortID提取不出内容来呢?麻烦大家看看
<!--center--> <%=WebContent("TeeYes_News",request.QueryString("SortID"),"")%>
<!--center-->
<%
function WebContent(DataFrom,ID,SortPath)
'-------------------
dim rs,sql ,conn
dim HideSort '未对外发布的类别
set rs = server.createobject("adodb.recordset")
if ID="" then
SortPath="0,"
elseif not IsNumeric(ID) then
response.write "暂无相关信息"
exit function
elseif conn.execute("select * from "&DataFrom&" Where ViewFlag and SortID="&ID).eof then
response.write "暂sadf相关信息"
exit function
else
SortPath=conn.execute("select * from "&DataFrom&" Where ViewFlag and SortID="&ID)("SortPath")
conn.execute("update "&DataFrom&" set ClickNumber=ClickNumber+1 Where SortID="&ID)
end if
sql="select * from "&DataFrom&" Where not(ViewFlag) and Instr(SortPath,'"&SortPath&"')>0"
rs.open sql,conn,1,1
while not rs.eof
HideSort="and not(Instr(SortPath,'"&rs("SortPath")&"')>0) "&HideSort
rs.movenext
wend
rs.close
'-------------------
dim idCount'记录总数
dim pages'每页条数
pages=15
dim pagec'总页数
dim page'页码
page=clng(request("Page"))
dim pagenc'每页显示的分页页码数量=pagenc*5+1
pagenc=5
dim pagenmax'每页显示的分页的最大页码
dim pagenmin'每页显示的分页的最小页码
dim pageprevious'上一相邻的页码
dim j '分页判断显示变量
j=1
dim pagenext
datafrom="TeeYes_NEWS"
dim datawhere
datawhere="where ViewFlag and Instr(SortPath,'"&SortPath&"')>0 "&HideSort& " "
dim sqlid
dim Myself,PATH_INFO,QUERY_STRING
PATH_INFO = request.servervariables("PATH_INFO")
QUERY_STRING = request.ServerVariables("QUERY_STRING")'
if QUERY_STRING = "" then
Myself = PATH_INFO & "?"
elseif Instr(PATH_INFO & "?" & QUERY_STRING,"Page=")=0 then
Myself= PATH_INFO & "?" & QUERY_STRING & "&"
else
Myself = Left(PATH_INFO & "?" & QUERY_STRING,Instr(PATH_INFO & "?" & QUERY_STRING,"Page=")-1)
end if
dim taxis
taxis="order by id desc "
dim i
sql="select count(ID) as idCount from ["& datafrom &"]" & datawhere
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,0,1
idCount=rs("idCount")
if(idcount>0) then'如果记录总数=0,则不处理
if(idcount mod pages=0)Then
pagec=int(idcount/pages)
else
pagec=int(idcount/pages)+1
end if
sql="select id from ["& datafrom &"] " & datawhere & taxis
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
rs.pagesize = pages
if page < 1 then page = 1
if page > pagec then page = pagec
if pagec > 0 then rs.absolutepage = page
for i=1 to rs.pagesize
if rs.eof then exit for
if(i=1)then
sqlid=rs("id")
else
sqlid=sqlid &","&rs("id")
end if
rs.movenext
next
end if
if(idcount>0 and sqlid<>"") then
sql="select * from ["& datafrom &"] where id in("& sqlid &") "&taxis
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,0,1
response.write "<div class=""FamilyHealthd-1"">"
response.write "<ul>"
while not rs.eof
response.write "<li>·<a href="""&SysRootDir&"News/Viewnews.asp?ID="&rs("ID")&""">"&StrLeft(rs("NewsName"),77)&"</a><span>"&FormatDate(rs("UpdateTime"),16)&"</span></li>"
rs.movenext
Wend
response.write "</ul>"
response.write "</div>"
else
response.write "<div>暂无相关信息</div>"
exit function
end if
Response.Write "<div style=""width:743px; height:55px; float:left; text-align:center; "">"
if (idCount>=0 or pagec>=1) then
Response.Write "共"&idCount&"条记录/共"&pagec&"页 <a href='Listnews.asp?page=1'>首页</a>"
end if
if (page>1) then
Response.Write " <a href='Listnews.asp?page="&page-1&"'><<</a>"
end if
if(pagec<=5) then
while(j<=pagec)
Response.Write " <a href='Listnews.asp?page="&j&"'>"&j&"</a>"
j=j+1
Wend
else
while(j<=5)
Response.Write " <a href='Listnews.asp?page="&j&"'>"&j&"</a>"
j=j+1
Wend
end if
if (page<pagec) then
Response.Write " <a href='Listnews.asp?page="&page+1&"'>>></a>"
end if
Response.Write " <a href='Listnews.asp?page="&pagec&"'>尾页</a>"
Response.Write " <input name=""Ytext"" type=""text"" style=""width:30px; height:12px;"" / ;> <span onclick=""javascript:GON()"" onMouseOver=""this.style.color='red';"" onMouseOut=""this.style.color='#000';"">跳转</span>"
Response.Write "</div>"
rs.close
set rs=nothing
end function
%>