if(exists (select * from sys.objects where name ='Proc_AddGood'))
drop proc Proc_AddGood
go
create proc Proc_AddGood
@Gname varchar(50),
@price money,
@Gimg varchar(50),
@Sid int,
@SName varchar(50)
as
begin
begin tran
begin try
insert into GoodInfo values(@Gname,@price,@Gimg,@Sid,@SName)
commit tran
end try
begin catch
rollback tran
end catch
end
if(exists(select * from sys.objects where name ='Proc_AddShop'))
drop proc Proc_AddShop
go
create proc Proc_AddShop
@Sname varchar(50)
as
begin
begin tran
begin try
insert into ShopInfo values(@Sname)
commit tran
end try
begin catch
rollback tran
end catch
end
if(exists(select * from sys.objects where name ='Proc_AddUser'))
drop proc Proc_AddUser
go
create proc Proc_AddUser
@Uid int,
@Uname varchar(50),
@Upwd varchar(50)
as
begin
begin tran
begin try
insert into UserInfo values(@Uid,@Uname,@Upwd)
commit tran
end try
begin catch
rollback tran
end catch
end
if(exists(select * from sys.objects where name ='Proc_Login'))
drop proc Proc_Login
go
create proc Proc_Login
@Uname varchar(50),
@Upwd varchar(50)
as
begin
begin tran
begin try
select * from UserInfo where Uname=@Uname and Upwd = @Upwd
commit tran
end try
begin catch
rollback tran
end catch
end
exec Proc_Login 'ym','123'