setnocounton
select@bbsname=subjectname,@manager=manager,@articles=articlesfrombbs_subjectswheresubjectID=@forumID
if@rootID=0
begin
--select@sql=declarem_curTempScrollcursorforselectID,title,shrink,rootID,orderID,pubtime,hits,bytes,username,emailfrombbs_forum_+@forumID+WHERErootIDin(selectdistinctrootIDfrombbs_forum_+@forumID+)orderbyrootIDdesc,orderIDasc
select@sql=declarem_curTempScrollcursorforselectrootIDfrombbs_forum_+@forumID+whererootID=parentIDorderbyrootIDdesc
end
else
select@sql=declarem_curTempScrollcursorforselectID,title,shrink,rootID,orderID,pubtime,hits,bytes,username,emailfrombbs_forum_+@forumID+whererootID=+@rootID+orderbyorderIDasc
exec(@sql)
openm_curTemp
set@pagecount=case
when@@cursor_rows%@a_intPageSize=0then@@cursor_rows/@a_intPageSize
when@@cursor_rows%@a_intPageSize0then@@cursor_rows/@a_intPageSize+1
end
if@@cursor_rows<@a_intPageSizeand@@cursor_rows>0
begin
select@pagecount=1
end
if@rootID=0
begin
set@temp=1
set@selectrootID=0
fetchabsolute@m_intStartRecordfromm_curTempinto@temprootID
while@@fetch_status=0and@temp<@a_intPageSize
begin
set@temp=@temp+1
select@selectrootID=@selectrootID+,+@temprootID
fetchnextfromm_curTempinto@temprootID
end
CLOSEm_curTemp
DEALLOCATEm_curTemp
setnocountoff
selectpagecount=@pagecount
selectbbsname=@bbsname
selectmanager=@manager
selectarticles=@articles
select@sql=declarecurTempScrollcursorforselectID,title,shrink,rootID,orderID,Images,pubtime,hits,bytes,username,emailfrombbs_forum_+@forumID+whererootIDin(+@selectrootID+)orderbyrootIDdesc,orderIDasc
exec(@sql)
opencurTemp
fetchfirstfromcurTemp
while@@fetch_status=0
begin
fetchnextfromcurTemp
end
CLOSEcurTemp
DEALLOCATEcurTemp
end
else
begin
set@temp=1
setnocountoff
fetchabsolute@m_intStartRecordfromm_curTemp
while@@fetch_status=0and@temp<@a_intPageSize
begin
set@temp=@temp+1
fetchnextfromm_curTemp
end
CLOSEm_curTemp
DEALLOCATEm_curTemp
end