rFields",200,1,2000,strFields)
Cmd.Parameters.Append Cmd.CreateParameter("@strTable",200,1,200,strTable)
Cmd.Parameters.Append Cmd.CreateParameter("@strWhere",200,1,800,strWhere)
Cmd.Parameters.Append Cmd.CreateParameter("@strOrderType",4,1,4,strOrderType)
Cmd.Parameters.Append Cmd.CreateParameter("@strKeyField",200,1,50,strKeyField)
SET RS=Cmd.Execute()
IF RecCount<1 THEN
Response.Write("没有记录")
ELSE
GetRecord=RS.GetRows(IntPageSize)
For i=0 To Ubound(GetRecord,2)
Response.Write(GetRecord(0,i),GetRecord(1,i),GetRecord(2,i)) ''...输出内容
NEXT
GetRecord=Null
END IF
SET RS=NOTHING
有用的朋友请自己慢慢调试吧,总记录是用ASP来取的,存储在SESSION里边,如果每次都统计一次总记录,将会非常费时,当然,如果你想在存储过程里来取总记录和总页数然后返回也是可以的,下边是代码:
--获取记录总数--
SET @tmpSQL=''SELECT @getRecordCounts=COUNT(''+@strKeyField+'') FROM ''+@strTable+@tmpWhere
EXEC sp_executesql @tmpSQL,N''@getRecordCounts int output'',@getRecordCounts OUTPUT
--获取总页数--
SET @tempFolatNumber=@getRecordCounts%@IntPageSize
IF @getRecordCounts<=@IntPageSize
SET @getPageCounts=1
ELSE
BEGIN
IF @tempFolatNumber != 0
SET @getPageCounts=(@getRecordCounts/@IntPageSize)+1
ELSE
SET @getPageCounts=(@getRecordCounts/@IntPageSize)
END
别忘了返回定义参数:
@getRecordCounts int output,--返回总记录
@getPageCounts int output--返回总页数