asp.net 存储过程CRUD

/******************************************************************
* 表名:Ph_AdInfo
* 时间:2008-8-30 20:14:06
******************************************************************/

------------------------------------
--用途:得到最大ID
--项目名称:
--说明:
--时间:2008-8-30 20:14:06
------------------------------------
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UP_Ph_AdInfo_GetMaxId]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[UP_Ph_AdInfo_GetMaxId]
GO
CREATE PROCEDURE UP_Ph_AdInfo_GetMaxId
AS
 DECLARE @TempID int
 SELECT @TempID = max([id])+1 FROM Ph_AdInfo
 IF @TempID IS NULL
  RETURN 1
 ELSE
  RETURN @TempID

GO

------------------------------------
--用途:是否已经存在
--项目名称:
--说明:
--时间:2008-8-30 20:14:06
------------------------------------
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UP_Ph_AdInfo_Exists]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[UP_Ph_AdInfo_Exists]
GO
CREATE PROCEDURE UP_Ph_AdInfo_Exists
@id int
AS
 DECLARE @TempID int
 SELECT @TempID = count(1) FROM Ph_AdInfo WHERE [id] = @id
 IF @TempID = 0
  RETURN 0
 ELSE
  RETURN 1

GO

------------------------------------
--用途:增加一条记录
--项目名称:
--说明:
--时间:2008-8-30 20:14:06
------------------------------------
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UP_Ph_AdInfo_ADD]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[UP_Ph_AdInfo_ADD]
GO
CREATE PROCEDURE UP_Ph_AdInfo_ADD
@id int ,
@PalecType int ,
@AdContent text ,
@AdType int ,
@Url varchar(200) ,
@Title varchar(100) ,
@CreateTime datetime
 AS
 INSERT INTO Ph_AdInfo(
 [id],[PalecType],[AdContent],[AdType],[Url],[Title],[CreateTime]
 )VALUES(
 @id,@PalecType,@AdContent,@AdType,@Url,@Title,@CreateTime
 )

GO

------------------------------------
--用途:修改一条记录
--项目名称:
--说明:
--时间:2008-8-30 20:14:06
------------------------------------
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UP_Ph_AdInfo_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[UP_Ph_AdInfo_Update]
GO
CREATE PROCEDURE UP_Ph_AdInfo_Update
@id int,
@PalecType int,
@AdContent text,
@AdType int,
@Url varchar(200),
@Title varchar(100),
@CreateTime datetime
 AS
 UPDATE Ph_AdInfo SET
 [PalecType] = @PalecType,[AdContent] = @AdContent,[AdType] = @AdType,[Url] = @Url,[Title] = @Title,[CreateTime] = @CreateTime
 WHERE [id] = @id

GO

------------------------------------
--用途:删除一条记录
--项目名称:
--说明:
--时间:2008-8-30 20:14:06
------------------------------------
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UP_Ph_AdInfo_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[UP_Ph_AdInfo_Delete]
GO
CREATE PROCEDURE UP_Ph_AdInfo_Delete
@id int
 AS
 DELETE Ph_AdInfo
  WHERE [id] = @id

GO

------------------------------------
--用途:得到实体对象的详细信息
--项目名称:
--说明:
--时间:2008-8-30 20:14:06
------------------------------------
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UP_Ph_AdInfo_GetModel]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[UP_Ph_AdInfo_GetModel]
GO
CREATE PROCEDURE UP_Ph_AdInfo_GetModel
@id int
 AS
 SELECT * FROM Ph_AdInfo
  WHERE [id] = @id

GO

------------------------------------
--用途:查询记录信息
--项目名称:
--说明:
--时间:2008-8-30 20:14:06
------------------------------------
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[UP_Ph_AdInfo_GetList]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[UP_Ph_AdInfo_GetList]
GO
CREATE PROCEDURE UP_Ph_AdInfo_GetList
 AS
 SELECT
 [id],[PalecType],[AdContent],[AdType],[Url],[Title],[CreateTime]
  FROM Ph_AdInfo

GO

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值