|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
ASP由于使用了COM组件所以它会变的十分强大,但是这样的强大由于WindowsNT系统最初的设计问题而会引发大量的安全问题。只要在这样的组件或是操作中一不注意,哪么外部攻击就可以取得相当高的权限而导致网站瘫痪或者数据丢失;两个高效的ASP分页函数(统计纪录数,分页提取纪录)<%
/*智能前往分页SQL语句*/
///<summary>
///功效:智能前往分页SQL语句
///</summary>
///<paramname="primaryKey">主键(不克不及为空)</param>
///<paramname="queryFields">提取字段(不克不及为空)</param>
///<paramname="tableName">表(实际上同意多表)</param>
///<paramname="condition">前提(能够空)</param>
///<paramname="OrderBy">排序,格局:字段名+""+ASC(能够空)</param>
///<paramname="pageSize">分页数(不克不及为空)</param>
///<paramname="pageIndex">以后页,肇端为:1(不克不及为空)</param>
///<returns></returns>
PublicFunctionGetPageListSql(primaryKey,queryFields,tableName,condition,orderBy,pageSize,pageIndex)
DimstrTmp,SqlSelect,SqlPrimaryKeySelect,strOrderBy,strWhere,strTop,pageindexsize
strTmp=""
//---strTmp用于前往的SQL语句
SqlSelect=""
SqlPrimaryKeySelect=""
strOrderBy=""
strWhere="where1=1"
strTop=""
pageindexsize=0
//0:分页数目
//1:提取字段
//2:表
//3:前提
//4:主键不存在的纪录
//5:排序
SqlSelect="selecttop{0}{1}from{2}{3}{4}{5}"
//0:主键
//1:TOP数目,为分页数*(排序号-1)
//2:表
//3:前提
//4:排序
SqlPrimaryKeySelect="and{0}notin(select{1}{0}from{2}{3}{4})"
iforderBy""then
strOrderBy="orderby"&orderBy
Endif
ifcondition""then
strWhere=strWhere&"and"&condition
pageindexsize=(pageIndex-1)*pageSize
Endif
ifcint(pageindexsize)>0then
strTop="top"&pageindexsize
SqlPrimaryKeySelect=Replace(Replace(Replace(Replace(Replace(SqlPrimaryKeySelect,"{0}",primaryKey),"{1}",strTop),"{2}",tableName),"{3}",strWhere),"{4}",strOrderBy)
strTmp=Replace(Replace(Replace(Replace(Replace(Replace(SqlSelect,"{0}",pageSize),"{1}",queryFields),"{2}",tableName),"{3}",strWhere),"{4}",SqlPrimaryKeySelect),"{5}",strOrderBy)
else
strTmp=Replace(Replace(Replace(Replace(Replace(Replace(SqlSelect,"{0}",pageSize),"{1}",queryFields),"{2}",tableName),"{3}",strWhere),"{4}",""),"{5}",strOrderBy)
Endif
GetPageListSql=strTmp
EndFunction
/*分页查询数据纪录总数猎取*/
///<summary>
///功效:分页查询数据纪录总数猎取
///</summary>
///<paramname="ptbName">----要显现的表或多个表的毗连</param>
///<paramname="pID">----主表的主键</param>
///<paramname="pstrCondition">----查询前提,不需where</param>
///<paramname="pDist">----是不是增加查询字段的DISTINCT默许0不增加/1增加</param>
///<returns></returns>
PublicFunctionGetPageListCounts(pID,ptbName,pstrCondition,pDist)
//---寄存获得查询了局总数的查询语句
//---对含有DISTINCT的查询举行SQL机关
//---对含有DISTINCT的总数查询举行SQL机关
DimstrTmp,SqlSelect,SqlCounts
strTmp=""
SqlSelect=""
SqlCounts=""
ifCInt(pDist)=0then
SqlSelect="Select"
SqlCounts="COUNT(*)"
else
SqlSelect="SelectDISTINCT"
SqlCounts="COUNT(DISTINCT"&pID&")"
Endif
ifpstrCondition=""then
strTmp=SqlSelect&""&SqlCounts&"FROM"&ptbName&""
else
strTmp=SqlSelect&""&SqlCounts&"FROM"&ptbName&"Where(1=1)and"&pstrCondition
EndIf
GetPageListCounts=strTmp
EndFunction
%>
ASP最大的缺点在于网络的安全性和可靠性,企业将经营数据放在开放的平台上,最大的担忧就是如何保证这些数据不被其他人破坏。 |
|