在博客园http://ltp.cnblogs.com/archive/2006/01/23/322290.aspx
这里看了他的代码生成工具。。写的真的不错。。
于是我也想研究了一下。。当然,我写的很垃圾。
看一下界面。
登陆以后。
随便点张表,自动生成的存储过程如下。
/**/
/*
是否已经存在
*/
create
proc
UP_users_IsHas
@u_id
int
as
declare
@TempID
int
select
@TempID
=
count
(
1
)
from
users
where
u_id
=
@u_id
if
(
@TempID
=
0
)
return
0
else
return
1
go
/**/
/*
增加一条记录
*/
create
proc
UP_users_Add
@u_id
int
,
@nS_id
int
,
@u_name
varchar
,
@u_pwd
varchar
,
@u_Q
varchar
,
@u_A
varchar
,
@u_email
varchar
,
@u_address
varchar
,
@u_tel
varchar
,
@u_regtime
datetime
,
@u_title
varchar
,
@u_sum
int
,
@u_wjieshao
varchar
,
@u_typeid
int
,
@u_grde
int
,
@u_sortNum
int
,
@u_liouyanNum
int
,
@u_pinglunNum
int
,
@u_newNum
int
as
insert
into
users(
nS_id,u_name,u_pwd,u_Q,u_A,u_email,u_address,u_tel,u_regtime,u_title,u_sum,u_wjieshao,u_typeid,u_grde,u_sortNum,u_liouyanNum,u_pinglunNum,u_newNum)
values
(
@nS_id
,
@u_name
,
@u_pwd
,
@u_Q
,
@u_A
,
@u_email
,
@u_address
,
@u_tel
,
@u_regtime
,
@u_title
,
@u_sum
,
@u_wjieshao
,
@u_typeid
,
@u_grde
,
@u_sortNum
,
@u_liouyanNum
,
@u_pinglunNum
,
@u_newNum
)
go
/**/
/*
修改一条记录
*/
create
proc
UP_users_update
@u_id
int
,
@nS_id
int
,
@u_name
varchar
,
@u_pwd
varchar
,
@u_Q
varchar
,
@u_A
varchar
,
@u_email
varchar
,
@u_address
varchar
,
@u_tel
varchar
,
@u_regtime
datetime
,
@u_title
varchar
,
@u_sum
int
,
@u_wjieshao
varchar
,
@u_typeid
int
,
@u_grde
int
,
@u_sortNum
int
,
@u_liouyanNum
int
,
@u_pinglunNum
int
,
@u_newNum
int
as
update
users
set
nS_id
=
@nS_id
,u_name
=
@u_name
,u_pwd
=
@u_pwd
,u_Q
=
@u_Q
,u_A
=
@u_A
,u_email
=
@u_email
,u_address
=
@u_address
,u_tel
=
@u_tel
,u_regtime
=
@u_regtime
,u_title
=
@u_title
,u_sum
=
@u_sum
,u_wjieshao
=
@u_wjieshao
,u_typeid
=
@u_typeid
,u_grde
=
@u_grde
,u_sortNum
=
@u_sortNum
,u_liouyanNum
=
@u_liouyanNum
,u_pinglunNum
=
@u_pinglunNum
,u_newNum
=
@u_newNumwhere
u_id
=
@u_id
go
/**/
/*
删除一条记录
*/
create
proc
UP_users_delete
@u_id
int
as
delete
users
where
u_id
=
@u_id
go
/**/
/*
查询一条信息
*/
create
proc
UP_users_select
@u_id
int
as
select
*
from
users
where
u_id
=
@u_id
go
/**/
/*
查询所有
*/
create
proc
UP_users_selectAll
@u_id
int
as
select
*
from
users
go
代码下载:
存储过程自动生成.rar