首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

迷茫了几天,求指教一下!下面是小弟我的代码

2012-01-01 
迷茫了几天,求各位高手指教一下!下面是我的代码!!--#include filewebconfig.asp--%Dim SortIDSortID

迷茫了几天,求各位高手指教一下!下面是我的代码!
<!--#include file="webconfig.asp"-->
<%
Dim SortID
SortID=Trim(FLib.SafeSql(Request("SortID")))
IF SortID<>"" then
Sql = "Select * from cartoon where ID ="&SortID
Set Rs = Db.CreateRS()
Rs.Open Sql, Db.Conn, 1, 1
If not Rs.eof then
SortName=Rs("SortName")
SortID=Rs("ID")
end if
Rs.close
set rs=nothing

End if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
  <link href="css/css.css" rel="stylesheet" type="text/css">
  <script src="js/muen.js" type="text/javascript"></script>
  <script src="js/buttom.js" type="text/javascript"></script>
</head>
<body>
 <div class="juzhong">
  <!--#include file="top.asp"-->
  <div class="guestbook">
  <div class="guestbook_left">
  <div class="guestbook_left_1">大标题</div>
  <div class="cartoon_left_2">
  <li><a href="weekly.asp">小标题1</a></li>
  <li><a href="lps/index.html">小标题1</a></li>
  <li><a href="cartoon.asp">小标题1</a></li>
  <li><a href="view.asp">小标题1</a></li>
  </div>
  </div>
  <div class="guestbook_right">
  <div class="guestbook_right_1">当前位置:</div>
  <div class="weekly_content_list">  
<%'开始分页
Const MaxPerPage=2
  dim totalPut  
  dim CurrentPage
  dim TotalPages
  dim j
 
  if Not isempty(request("page")) then
  currentPage=Cint(request("page"))
  else
  currentPage=1
  end if 
Set Rs = Db.CreateRS()
sql="select * from weeklySort where ID>0"
namekey=FLib.SafeSql(Request("namekey"))
if namekey<>"" then  
sql=sql&" and SortName like '%"&namekey&"%'"  
end if
if SortID<>"" then
sql=sql&" and SortID="&SortID&""
end if
sql=sql&" order by PX desc"
Rs.Open Sql, Db.Conn, 1, 1
 
if err.number<>0 then
response.write "数据库中无数据"
end if

  if rs.eof And rs.bof then
  Response.Write "<p align='center' class='contents'> 没有此类信息!<a href='#' onclick='history.go(-1);'>返回上一步</a></p>"
  else
totalPut=rs.recordcount

  if currentpage<1 then
  currentpage=1
  end if

  if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
  end if

  if currentPage=1 then
  showContent
  showpage totalput,MaxPerPage,"weekly.asp"


  else
  if (currentPage-1)*MaxPerPage<totalPut then
  rs.move (currentPage-1)*MaxPerPage
  dim bookmark
  bookmark=rs.bookmark
  showContent
  showpage totalput,MaxPerPage,"weekly.asp"
  else
currentPage=1
  showContent
  showpage totalput,MaxPerPage,"weekly.asp"
end if
end if
  end if

  sub showContent
  dim i
i=0
%>
  <div>
  <%
cols=3
do while not rs.eof
if abc mod cols=0 then response.Write("<tr>")
abc=abc+1
%>
  <div class="weekly_content_list_table">
  <div class="weekly_content_list_time">
  <img src="../<%=rs("SmallPic")%>" />
  </div>
  <div class="weekly_content_list_name" style="background-color:#999; text-align:center; font-size:17px;"><%=rs("SortName")%></div>
  <div class="weekly_content_list_name">
<%
  Set Rs = Db.CreateRS()
  Sql = "Select top 4 ID,ProductName,SortID,AddTime from weekly where SortID=SortID"
  Rs.Open Sql, Db.Conn, 1, 1
  if Not Rs.eof then
  do while not rs.eof%>
  <li><a href="viewweek.asp?weeklyID=<%=Rs("ID")%>&SortID=<%=sortid%>" target="_blank"><span><%=left(Rs("ProductName"),8)%></span></a></li>
<%
  rs.movenext
  loop
  end if
  rs.close
  set rs=nothing
%>
  </div>
  </div>

<%
i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing%>
  </div>
  </div>
  <div class="case_content_list_fanye">
  <%  
End Sub  
  
Function showpage(totalnumber,maxperpage,filename)  
  Dim n
 
If totalnumber Mod maxperpage=0 Then  
n= totalnumber \ maxperpage  
Else
n= totalnumber \ maxperpage+1  
End If
if SortID<>"" then
Response.Write "<form method=Post action="&filename&"?SortID="&SortID&">"
else
Response.Write "<form method=Post action="&filename&">"
end if 
Response.Write "<p align='center'> "  
If CurrentPage<2 Then  
Response.Write "首页 上一页"  
Else  
Response.Write "<a href="&filename&"?page=1>首页</a> "
if SortID<>"" then 
Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&SortID="&SortID&">上一页</a> "
else
response.Write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a> "
end if
End If

If n-currentpage<1 Then  
Response.Write "下一页 尾页"  


Else 
if SortID<>"" then 
Response.Write " <a href="&filename&"?page="&(CurrentPage+1)&"&SortID="&SortID&">"  
Response.Write "下一页</a> <a href="&filename&"?page="&n&"&SortID="&SortID&">尾页</a>" 
else
Response.Write " <a href="&filename&"?page="&(CurrentPage+1)&">"  
Response.Write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>" 
end if 
End If  
Response.Write " 页次:"&CurrentPage&"/"&n&"页"  
Response.Write " 共有"&totalnumber&"条信息 " 
Response.Write "转到:<input type='text' name='page' size=2 maxlength=10 value="&currentpage&">"  
Response.Write "&nbsp;<input type='submit' value='GO' name='cndok'></form>"  
End Function  
%> </span>
  </div>
  </div>
  </div>
  <!--#include file="foot.asp"-->
 </div>
</body>
</html>

[解决办法]
迷茫了几天...... 你真幸福啊
asp 不懂 

帮顶

热点排行