当前位置: 首页 > 图文教程 > 网络编程 > ASP > 邹建的分页存储过程改了一下

ASP
ASP编程中15个非常有用的例子 (二)
ASP与JSP的比较(一)
ASP与JSP的比较(二)
ASP中五种连接数据库的方法
从ASP调用SQL中的图像
用排序串字段实现树状结构(例程:连接字串)
用排序串字段实现树状结构(例程:删除贴子)
用排序串字段实现树状结构(例程:回复表单)
用排序串字段实现树状结构(例程:显示贴子内容)
用排序串字段实现树状结构(例程:显示树)
用排序串字段实现树状结构(存储过程)
用排序串字段实现树状结构(库结构)
用排序串字段实现树状结构(原理)
remote script文档(转载自微软)(一)
remote script文档(转载自微软)(二)
remote script文档(转载自微软)(三)
remote script文档(转载自微软)(四)
remote script文档(转载自微软)(五)
remote script文档(转载自微软)(六)
remote script文档(转载自微软)(七)

ASP 中的 邹建的分页存储过程改了一下


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 125 ::
收藏到网摘: n/a

邹建的分页存储过程--改了一下
因为邹建的分页存储过程不能返回记录总数,所以每次分页还又要统计一次,所以自己在里面加了个返回记录数,这下就好用了。
@iPageCount int OUTPUT --定义输出变量,放在@QueryStr上面
....
exec('select'+@FdShow+'from'+@QueryStr+@FdOrder) --统计记录数,放在--如果显示第一页...上面
Select @iPageCount = @@rowcount
调用方法(ASP):
MyConStr = "Driver={SQL Server};server=(local);Uid=artme;Pwd=***;Database=artme"
DIM MyComm,UserID,UserName
Set MyComm = Server.CreateObject("ADODB.Command")
with MyComm
.ActiveConnection = MyConStr 'MyConStr是数据库连接字串
.CommandText = "p_show" '指定存储过程名
.CommandType = 4 '表明这是一个存储过程
.Prepared = true '要求将SQL命令先行编译
.Parameters.Append .CreateParameter("RETURN",2,4)
.Parameters.Append .CreateParameter("@iPageCount",3,2)
.Parameters.append .CreateParameter("@QueryStr",200,1,4000,"select * from zw_language")
.Parameters.append .CreateParameter("@PageSize",3,1,4,5)
.Parameters.append .CreateParameter("@PageCurrent",3,1,4,1)
.Parameters.append .CreateParameter("@FdShow",200,1,4000)
.Parameters.append .CreateParameter("@FdOrder",200,1,1000)
.Execute
end with
iCount = MyComm(1)
Response.write iCount


Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=566682