国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

使用存儲過程實現分頁打印

2024-07-21 02:09:11
字體:
來源:轉載
供稿:網友


使用存儲過程實現分頁打印。

這個存儲過程是一個小區寬帶用戶管理系統,項目里代碼的一部分。

功能是:
實現把表userinfo里的用戶資料按ip網段排序進行分頁打印!!
比如172.20.128.xx的ip簡稱為128網段的用戶,
172.20.119.xx的ip簡稱為119網段的用戶,

每個網段的用戶打印在一張a4紙上,
不足一張的按一張打印,其余的可空出。
大于一張小于兩張的按二張打印,其余空出.
經過估算一頁最多只能打印37行.
思路是:先把select出的按ip分組的用戶信息和計算出的空格行insert進一個臨時表中
然后多此臨時表打印就行了。

 

--首先清空表
--truncate table subip

declare @result int
declare @subip varchar(20)
declare cur_e scroll cursor for
   select substring(ip_address,8,3) from userinfo group by substring(ip_address,8,3)

open cur_e--打開游標
--print 'aaa'+convert(char(13),@@cursor_rows)
 fetch first from cur_e into @subip

while(@@fetch_status=0)
 begin
  --insert into subip (supip)values (@subip)
   insert into subip select userinfo.username,userinfo.catalyst_port,userinfo.home_address,
userinfo.ip_address,userinfo.phone,catalyst.label,'' from userinfo,
catalyst where userinfo.catalyst_id=catalyst.id and substring(userinfo.ip_address,8,3) [email protected]
   set @[email protected]@rowcount
      if(@result>37)
        begin
          while(@result<74)
           begin
           insert into subip select

username='',catalyst_port='',home_address='',ip_address='',phone='',label='',account=''
           set @[email protected]+1
           end
        end
      else
        begin
          while (@result<37)
           begin
            insert into subip select

username='',catalyst_port='',home_address='',ip_address='',phone='',label='',account=''
           set @[email protected]+1
           end
         end
   --select @@rowcount
  fetch next from cur_e into @subip
 end
close cur_e
deallocate cur_e
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 湘阴县| 平顶山市| 平南县| 龙门县| 平武县| 合水县| 辽宁省| 峨眉山市| 泗洪县| 左贡县| 延长县| 怀仁县| 宝丰县| 松溪县| 吕梁市| 巴林左旗| 象山县| 左云县| 历史| 清丰县| 稻城县| 闽侯县| 弥勒县| 西丰县| 靖西县| 永顺县| 景洪市| 毕节市| 巢湖市| 朝阳市| 聂拉木县| 保康县| 鹰潭市| 江都市| 望江县| 临洮县| 弥勒县| 宜州市| 台山市| 疏附县| 东乡族自治县|