我就寫了一個讀取數據庫的東東,顯示卻如下:
數據全能在數據庫中讀出,但卻沒有顯示。請各位幫幫忙。
以下源代碼,有點長,請幫忙耐心一點看看,謝謝了
<!--#include file =conn2.asp-->
<%if session("pass")<>"ok" then
Response.Redirect "pass.asp"
Response.End
end if
%>
<%
const MaxPerPage=16
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim typename
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
dim sql
dim rs
dim rstype
dim typesql
dim typeid,typename1
if not isEmpty(request("typeid")) then
typeid=request("typeid")
else
typeid=1
end if
%>
<%
user_lib="admin"
Set radmin = Server.CreateObject("ADODB.Recordset")
sql="select * from weix order by tjsj desc"'"
radmin.open sql,conn,3,2
%>
<html>
<head>
<script language=javascript>
function Page_Change(i)
{
self.location='weixedit.asp?page='+i;
}
</script>
<title>後 臺 管 理</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<link rel="stylesheet" type="text/css" href="../type.css">
<style type="text/css">
<!--
.style1 {color: #0000FF}
.t12 {font-size: 12px}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" >
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#00CCFF">
<tr>
<td height="32">
<div align="center"><b><font color="#FF0000" size="4" face="黑體"> 後 臺 管 理</font></b></div>
<center>
</center></td>
</tr>
</table>
<table width="770" border="0" cellspacing="0" cellpadding="0" align="center">
<tr bgcolor="#FF0000">
<td height="26"><div align="center"></div>
<font color="#FFFFFF"></font>
<div align="center">
<center>
<div align="left"> </div>
</center>
</div>
<div align="center"><b><a href="jlbedit.asp"><font color="#FFFFFF">電 腦 報 修 管 理 </font></a></b><font color="#FFFFFF"><b> | </b></font><b><a href="teledit.asp"><font color="#FFFFFF"> 電 話 報 修 管 理</font></a></b><font color="#FFFFFF"><b> | </b><font color="#FFFFFF"><b><a href="hcaiedit.asp"><font color="#FFFFFF"><b>零 件 申 購 管 理</b></font></a></b></font></font> <font color="#FFFFFF"><b> | <a href="shenedit.asp"><font color="#FFFFFF"> 電 腦 申 購 管 理</font></a></b><font color="#FFFFFF"><b> | <a href="weixedit.asp"><font color="#FFFFFF"><b> 設 備 維 修 管 理</b></font></a></b></font></font></div></td>
</tr>
</table>
<br>
<table border="0" width="770" cellspacing="0" cellpadding="0" height="72" align="center">
<tr>
<td width="100%" align=center>
<%
sql="select * from weix order by weix_id desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'>暫時沒有信息!</p>"
else
totalPut=rs.recordcount
TotalPage = RS.PageCount
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
showpage totalput,MaxPerPage,"weixedit.asp"
showContent
showpage totalput,MaxPerPage,"weixedit.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"weixedit.asp"
showContent
showpage totalput,MaxPerPage,"weixedit.asp"
else
currentPage=1
showpage totalput,MaxPerPage,"weixedit.asp"
showContent
showpage totalput,MaxPerPage,"weixedit.asp"
end if
end if
rs.close
end if
set rs=nothing
sub showContent
dim i
i=0
%>
<table cellspacing="0" bordercolorlight="#FFFFFF" width="770">
<tr align="center">
<td valign="top" colspan="3">
<table width="100%" cellpadding="0" cellspacing="1" border="0" bordercolordark="#FFFFFF" bordercolorlight="#808080" bgcolor="#66CCCC" >
<tr bgcolor="#66FFCC" >
<td width="59" align="center" height="25" class="test12">
<div align="center"><b><font color="#333333" size="2">單據號</font></b></div>
</td>
<td width="83" height="25" class="test12">
<div align="center"><b><font color="#333333" size="2">刪除</font></b></div>
</td>
<td width="80" class="test12"><div align="center"><strong>修改</strong></div></td>
<td width="93" height="25" class="test12">
<div align="center"><b><font size="2">詳細資料</font></b></div>
</td>
<td width="119" align="center" height="25" class="test12">
<div align="center"><b><font size="2" color="#333333">耗材申購</font></b></div></td>
<td width="182" align="center" class="test12"><div align="center"><strong>提交時間</strong></div></td>
<td width="142" align="center" class="test12"><strong>處理情況</strong></td>
</tr>
<%do while not rs.eof
weix_id=rs("weix_id")
wcqk=rs("wcqk")
nr=rs("nr")
tjsj=rs("tjsj")
cap=server.urlencode(weix_id)
%>
<tr bgcolor="#FFFFFF" >
<td width="59" align="center" height="25" class="test12">
<div align="center"><font size="2" color="#FF0000"><%=weix_id%></font></div>
</td>
<td width="83" height="25" class="test12">
<div align="center"><font size="2"><a href="dele_weix.asp?id=<%=weix_id%>" class="style1">刪除</a></font></div>
</td>
<td width="80" height="25" class="test12"><div align="center"><a href="editweix.asp?weix_id=<%=weix_id%>" target="_blank">修改</a></div></td>
<td width="93" height="25" class="test12">
<div align="center"><font size="2"><a href="weixxs.asp?weix_id=<%=weix_id%>" target="_blank" class="style1">詳細資料</a></font></div>
</td>
<td width="119" align="center" height="25" class="test12">
<div align="center"><font size="2"> <%=nr%> </font></div></td>
<td width="182" height="25" align="center" class="test12"><div align="center"><font size="2"><%=tjsj%></font></div></td>
<td width="142" height="25" align="center" class="test12"><font size="2"><%=wcqk%></font></td>
</tr>
<% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>
<%
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
response.write "<form method=Post action='weixedit.asp?user="&username&"'>"
response.write "<p align='center' vAlign='bottom'>"
if CurrentPage<2 then
response.write "<font color='999966'>首頁 下一頁</font> "
else
response.write "<a href="&filename&"?page=1&typename="&typename&"&keyword="&keyword&">首頁</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&"&typename="&typename&"&keyword="&keyword&">下一頁</a> "
end if
if n-currentpage<1 then
response.write "<font color='999966'>上一頁 尾頁</font>"
else
response.write "<a href="&filename&"?page="&CurrentPage+1&"&typename="&typename&"&keyword="&keyword&">上一頁</a> "
response.write "<a href="&filename&"?page="&n&"&typename="&typename&"&keyword="&keyword&">尾頁</a>"
end if
response.write " 頁次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>"
response.write " 共<b>"&totalnumber&"</b>條信息 <b>"&maxperpage&"</b>條信息/頁 "
response.write " 轉到:"
%>
<select name="Page" onChange="Page_Change(this.options[this.selectedIndex].value)" <% if totalpage = 0 then Response.Write("disabled")%> size=1 class=smallselsect style="BACKGROUND-COLOR:#BBE3FF;font-family: verdana; font-size:7pt;">
<% for I = 1 to n %>
<option value="<%=I%>" <% if I = CInt(CurrentPage) then Response.write("selected") end if %>>第<%=I%>頁</option>
<% Next %>
</select>
<%
end function
%>
</td>
</tr>
</table>
</table>
<%
radmin.close
set radmin=nothing%>