这是网上收的代码,还有一个是转好了的DV8.0的,呆会传个地址上来!
以下是代码片段:
[em80]
我们的原则就是:免费到家,免费到个人!
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Dv_TSQL]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[Dv_TSQL]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Dv_loadSetup]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[Dv_loadSetup]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[dv_Dispbbs]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[dv_Dispbbs]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[dv_list]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[dv_list]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[dv_toplist]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[dv_toplist]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [Dv_TSQL]
@tsql varchar(500)
AS
exec(@tsql)
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [Dv_loadSetup]
AS
Select * from [Dv_setup]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dv_Dispbbs]
@boardid int=1,
@pagenow int=1, --当前页数
@pagesize int=1, --定义每页面帖子数目
@Announceid int=1,
@TotalUseTable nvarchar(10) ='Dv_bbs1'
AS
set nocount on
Select AnnounceID from [Dv_bbs1] Where BoardID=@BoardID And RootID=@Announceid Order By AnnounceID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dv_list]
@boardid int=1,
@pagenow int=1, --当前页数
@pagesize int=1, --定义每页面帖子数目
@tl int=0, --按时间段查询
@topicmode int=0, --专题
@totalrec int output
AS
set nocount on
declare @int_topnum int
declare @int_timenum int
declare @var_times varchar(5000)
if @pagenow>1
if @topicmode>0
begin
select @int_timenum=(@pagenow-1)*@pagesize
set rowcount @int_timenum
select @var_times=lastposttime from Dv_Topic where mode=@topicmode and boardID=@boardID and istop = 0 ORDER BY lastposttime desc
set rowcount @pagesize
select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode,GetMoney,GetMoneyType,UseTools,IsSmsTopic,HideName from dv_topic where mode=@topicmode and boardID=@boardID and istop = 0 and lastposttime < @var_times ORDER BY lastposttime desc
set nocount off
return
end
else
begin
select @int_timenum=(@pagenow-1)*@pagesize
set rowcount @int_timenum
select @var_times=lastposttime from Dv_Topic where boardID=@boardID and istop = 0 ORDER BY lastposttime desc
set rowcount @pagesize
select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode,GetMoney,GetMoneyType,UseTools,IsSmsTopic,HideName from dv_topic where boardID=@boardID and istop = 0 and lastposttime < @var_times ORDER BY lastposttime desc
set nocount off
return
end
else
if @topicmode>0
begin
set rowcount @pagesize
select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode,GetMoney,GetMoneyType,UseTools,IsSmsTopic,HideName from Dv_topic where mode=@topicmode and boardID=@boardid and istop = 0 ORDER BY lastposttime desc
end
else
begin
set rowcount @pagesize
select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode,GetMoney,GetMoneyType,UseTools,IsSmsTopic,HideName from Dv_topic where boardID=@boardid and istop = 0 ORDER BY lastposttime desc
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dv_toplist]
@pagenow int ,
@pagesize int ,
@reture_value int output,
@intUserRecordCount int output
as
/*定义局部变量*/
declare @intBeginID int
declare @intEndID int
declare @intPageCount int
declare @intRowCount int
/*关闭计数*/
set nocount on
/*求总用户数*/
select @intUserRecordCount = count(*) from [dv_user]
if (@intUserRecordCount = 0) --如果没有用户,则返回零
set @reture_value =0
/*判断页数是否正确*/
if (@pagenow - 1) * @pagesize > @intUserRecordCount
set @reture_value =1
--return (-1)
/*求开始userID*/
set @intRowCount = (@pagenow - 1) * @pagesize + 1
/*限制条数*/
set rowcount @intRowCount
select @intBeginID = userid from [dv_user] order by userid desc
/*结束userID*/
set @intRowCount = @pagenow * @pagesize
/*限制条数*/
set rowcount @intRowCount
select @intEndID = userid from [dv_user] order by userid desc
/*恢复系统变量*/
set rowcount 0
set nocount off
select username,useremail,userclass,UserIM,UserPost,JoinDate,userwealth,userid from [dv_user] where userid between @intEndID and @intBeginID order by userid desc
return(@@rowcount)
--select @@rowcount
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO