求解答:sql2000下的分页问题,存储过程如下:但在jsp中是如何调用来进行分页的?

fuzhan820 2004-02-25 04:51:40
用于分页的sql2000存储过程)如下

CREATE PROCEDURE SP_GetauthorPage(

@CurrentPage int,

@PageSize int

) AS

declare @sSQL1 varchar(500)

declare @sSQL2 varchar(500)

declare @iCount int

declare @PageCount int

declare @RecordCount int



set @iCount=@CurrentPage*@PageSize

print @iCount



select @RecordCount=Count(*) from author

print @RecordCount



if @RecordCount >0

begin

if @RecordCount % @PageSize=0

begin

set @PageCount=@RecordCount/@PageSize

end

else

begin

set @PageCount=@RecordCount/@PageSize+1

end

if @CurrentPage<=@PageCount and @CurrentPage>0

begin

set @sSQL1='(select top '+ ltrim(rtrim(str(@iCount))) +' * from author order by au_lname ) as tmp'

--print @sSQL1



set @sSQL2='select top ' +ltrim(rtrim(str(@PageSize)))+' * from '+@sSQL1 +' order by au_lname desc '

print @sSQL2



EXEC(@sSQL2)

end

else

begin

select top 0 * from author

end



end

else

begin

select * from author

end

GO

这个过程已在本机上执行通过。
问题:
1.在jsp中是如何调用这个存储过程的?
2.具体的是怎样让数据显示出来的(下一页,上一页)。
哪位高手有源程序啊。

...全文
51 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧