快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

ASP关于分页办法

    时间关系,没有经过完全测试,这个是大概意思。
  CREATE PROCEDURE getnotes
  
   @forumID varchar(10),
   @a_intPageNo int ,
   @a_intPageSize int,
   @rootID varchar(10)
  AS
   declare @m_intRecordNumber int
   declare @m_intStartRecord int
   declare @pagecount int
   declare @temp int
   declare @end int
   declare @sql varchar(500)
   declare @bbsname varchar(25)
   declare @articles int
   declare @manager varchar(30)
   declare @selectrootID varchar(500)
   declare @temprootID varchar(10)
  
   select @m_intRecordNumber = @a_intPageSize * @a_intPageNo
   select @m_intStartRecord = @a_intPageSize * (@a_intPageNo - 1) + 1
  
   set nocount on
   select @bbsname=subjectname,@manager=manager,@articles=articles from bbs_subjects where subjectID=@forumID
   if @rootID=\\'0\\'
   begin
   -- select @sql=\\'declare m_curTemp Scroll cursor for select ID,title,shrink,rootID,orderID,pubtime,hits,bytes,username,email from bbs_forum_\\'+@forumID+\\' WHERE rootID in (select distinct rootID from bbs_forum_\\'+@forumID+\\' ) order by rootID desc,orderID asc\\'
   select @sql=\\'declare m_curTemp Scroll cursor for select rootID from bbs_forum_\\'+@forumID+\\' where rootID=parentID order by rootID desc\\'
   end
   else
   select @sql=\\'declare m_curTemp Scroll cursor for select ID,title,shrink,rootID,orderID,pubtime,hits,bytes,username,email from bbs_forum_\\'+@forumID+\\' where rootID=\\'+@rootID+\\' order by orderID asc\\'
  
   exec(@sql)
   open m_curTemp
  
   set @pagecount = case
   when @@cursor_rows % @a_intPageSize=0 then @@cursor_rows / @a_intPageSize
   when @@cursor_rows % @a_intPageSize<>0 then @@cursor_rows / @a_intPageSize+1
   end
   if @@cursor_rows<@a_intPageSize and @@cursor_rows>0
   begin
   select @pagecount=1
   end
  
  
   if @rootID=\\'0\\'
   begin
   set @temp = 1
   set @selectrootID=\\'0\\'
   fetch absolute @m_intStartRecord from m_curTemp into @temprootID
   while @@fetch_status = 0 and @temp < @a_intPageSize
   begin
   set @temp = @temp + 1
   select @selectrootID=@selectrootID+\\',\\'+@temprootID
   fetch next from m_curTemp into @temprootID
   end
   CLOSE m_curTemp
   DEALLOCATE m_curTemp
   set nocount off
   select \\'pagecount\\' = @pagecount
   select \\'bbsname\\'=@bbsname
   select \\'manager\\'=@manager
   select \\'articles\\'=@articles
   select @sql=\\'declare curTemp Scroll cursor for select ID,title,shrink,rootID,orderID,Images,pubtime,hits,bytes,username,email from bbs_forum_\\'+@forumID+\\' where rootID in (\\'+@selectrootID+\\') order by rootID desc,orderID asc\\'
   exec(@sql)
   open curTemp
   fetch first from curTemp
   while @@fetch_status = 0
   begin
   fetch next from curTemp
   end
   CLOSE curTemp
   DEALLOCATE curTemp
   end
   else
   begin
   set @temp = 1
   set nocount off
   fetch absolute @m_intStartRecord from m_curTemp
   while @@fetch_status = 0 and @temp < @a_intPageSize
   begin
   set @temp = @temp + 1
   fetch next from m_curTemp
   end
   CLOSE m_curTemp
   DEALLOCATE m_curTemp
   end
返回类别: 教程
上一教程: WSH实用讲座---第四讲 配置目录权限
下一教程: 资料验证的asp.net程序

您可以阅读与"ASP关于分页办法"相关的教程:
· 关于分页办法
· 在ASP中,用JSCRIPT脚本实现分页的另类办法
· ASP中关于帖子分页显示的基本方式
· ASP用于分页的两个函数
· 用ASP实现长文章用分页符来分页显示
    微笑服务 优质保证 索取样品