📄 test2.asp
字号:
<!-- #include file = "db.inc" -->
<!-- #include file = "datahandle.inc" -->
<!-- #include file = "recordlist.inc" -->
<!-- include file = "../config/tools.asp" -->
<!-- #include file="test2.inc" -->
<html>
<head>
<style type="text/css">
<!-- @import url(../common.css); -->
</style>
</head>
<body>
<%
Dim iTotalRecords : iTotalRecords = 0 ' 分页
Dim iRecordsPerPage : iRecordsPerPage = 10
Dim iTotalPages : iTotalPages = 0
Dim iCurrentPage
Dim iCols : iCols = 9
'--------------------------------------
' 构造SQL语句
'--------------------------------------
dim sSQL, sWhere, sOrderby
sSQL = "select serial, emp_serial, name, company_name, position_id, company_phone, fax, email" & _
" from t_personalcard" & _
" where emp_serial = 54"
'--------------------------------------
' 获取总的记录数,以便分页
'--------------------------------------
iTotalRecords = TotalRecords(dbLocal, sSQL)
if iTotalRecords = 0 then
Response.write "( 没有任何记录 )<br>"
Response.end
end if
'--------------------------------------
' 计算总页数,当前页码
'--------------------------------------
if iTotalRecords mod iRecordsPerPage = 0 then
iTotalPages = int(iTotalRecords / iRecordsPerPage)
else
iTotalPages = int(iTotalRecords / iRecordsPerPage) + 1
end if
iCurrentPage = GetParam("Page")
if IsEmpty(iCurrentPage) then
iCurrentPage = 1
end if
if Not isNumeric(iCurrentPage) then
iCurrentPage = 1
end if
iCurrentPage = CInt(iCurrentPage) ' 转化成整数再与iTotalPages比较,否则就是比较出来的结果是不正确的
if iCurrentPage > iTotalPages then
iCurrentPage = iTotalPages
end if
'--------------------------------------
' 查询参数等
'--------------------------------------
Dim sFileName, sFormParams
sFileName = "test2.asp"
sFormParams = "f=&"
'--------------------------------------
' 排序列、排序方向、排序参数
'--------------------------------------
Dim iSort, iSorted, sSortParams
iSort = GetParam("Sorting")
iSorted = GetParam("Sorted")
if IsEmpty(iSort) then
iSort = ""
elseif iSort<>"name" and iSort<>"company_name" and iSort<>"position_id" and iSort<>"phone" and iSort<>"fax" and iSort<>"email" then
iSort = ""
else
if iSort = iSorted then ' 这一列是上次排序的列,则将iSorted的值置空""(降序排列),否则置iSort的值(升序排列)
sDirection = " desc"
sSortParams = "Sorting=" & iSort & "&Sorted=" & iSorted & "&"
iSorted = ""
else
sDirection = " asc"
sSortParams = "Sorting=" & iSort & "&Sorted=" & "&"
iSorted = iSort
end if
end if
if iSort <> "" then
sOrderby = " order by " & iSort & sDirection
end if
'response.write strsql & strWhere1 & sOrderby : response.end
Response.write TableHeader()
Response.write TableRecords(sSQL & sOrderby, iCols, iRecordsPerPage, iTotalRecords, iCurrentPage, iTotalPages, sFileName, sFormParams, sSortParams)
Response.write TableTailer()
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -