|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
asp可以使用微软的activeX 使得网页功能无比强大,不过安全性也较差,而且是基于的windows服务器,所以性能稳定性也一般函数|数据|显示 <%
REM -----------------------------------
REM 作 者:王勤军 qinjunit@yahoo.com
REm 创作日期:2004-10-12
REM 修正日期:2005年1月24日 礼拜一
REM -----------------------------------
'函数 适用数据分页显示函数
'参数:DataSQL ----------- 以后页面数据的SQL语句
'参数:CountSQL ----------- 查询总条数的SQL语句
'参数:Page ----------- 哪 页
'参数:PageSize ----------- 页 次
'参数:THeadStrings ------- 显示表头列称号界说,用“,”分隔,与DataSQL外面的列名对应。
'实 例:=======================================
'<!--#include virtual="inc/conn.asp"-->
'<!--#include virtual="inc/RW_DataPager.asp"-->
'<%
'dim iPageSize,CurPage
' iPageSize = 18
' CurPage = 1
'if (Request.Form <> "") then
' if IsEmpty(Request.Form("p")) then
' CurPage = 1
' elseif IsNumeric(Request.Form("p")) then
' CurPage = CLng(Request.Form("p"))
' end if
'end if
'ShowRecords "exec p_show accounts,"&iPageSize&","&CurPage&",'account_code,account_password,account_serial,account_type,account_money,stock_time'","select count(account_code) as total from [accounts]",CLng(CurPage),iPageSize,"卡号,暗码,序列号,卡类型,卡金额,入库工夫"
'CloseDB()
'% >
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub ShowRecords(DataSQL,CountSQL,Page,PageSize,ModelStrings,THeadStrings)
dim total,rs,DatMessages
dim UseDataModel
if (Request.Form("pagerTotal") <> "") then
total = CLng(Request.Form("PagerTotal"))
else
total = conn.execute(CountSQL)(0)
end if
if Len(ModelStrings)<8 then '模版长度在此界说为8
UseDataModel = false
else
UseDataModel = true
end if
DatMessages = DatMessages & "<table width=""100%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" style=""Border-Collapse:collapse;word-break:break-all"">"
DatMessages = DatMessages & "<form name=""frmPager"" id=""frmPager"" method=""post"">"
if Clng(total) <> 0 then
'set rs = conn.execute(DataSQL)
REM 非存储进程分页====================
set rs=server.createobject("ADODB.RECORDSET")
rs.Open DataSQL,conn,1,1
rs.PageSize=PageSize
rs.AbsolutePage=Page
REM ==================================
dim thArray,ColCount,k,thStr,i
i = 1 '初始化记数器
ColCount = rs.Fields.Count '获得总列数
if not UseDataModel then '不利用模版操作
if Len(THeadStrings)<1 then
for k = 0 to (rs.Fields.Count-1)
thStr = thStr & rs.Fields(k).name&","
next
thArray = Split((Mid(thStr,1,len(thStr)-1)),",")
else
thArray = Split(THeadStrings,",")
End if
DatMessages = DatMessages & "<tr bgcolor=""#BFE8FB"">"
for k=0 to (ColCount-1)
DatMessages = DatMessages & "<th class='hyxxtext'>"&thArray(k)&"</th>"
next
DatMessages = DatMessages & "</tr>"
else
DatMessages = DatMessages & "<tr><td>"
end if
'---------数据轮回入手下手------------'
while (not rs.eof and i<PageSize)
if not UseDataModel then
if (i mod 2 =0 ) then
DatMessages = DatMessages & "<tr bgcolor=""#E1F4FD"">"
else
DatMessages = DatMessages & "<tr bgcolor=""#FFFFFF"">"
end if
for k=0 to (ColCount-1)
DatMessages = DatMessages & "<td>"&rs(k)&"</td>"
next
DatMessages = DatMessages & "</tr>"
else '批量交换模版数据
Dim OneNoteString
OneNoteString = ModelStrings
for k=0 to (ColCount-1)
if IsNull(rs(k)) then
OneNoteString = WordStr(OneNoteString,"{$DATA#"&(k+1)&"}","")
else
OneNoteString = WordStr(OneNoteString,"{$DATA#"&(k+1)&"}",HtmlString(rs(k)))
</p> asp可以使用微软的activeX 使得网页功能无比强大,不过安全性也较差,而且是基于的windows服务器,所以性能稳定性也一般 |
|