日期:2014-05-17  浏览次数:20457 次

第一次用存储进程,求解惑
这是添加数据的一个存储进程:
SQL code
CREATE PROCEDURE [dbo].[Proc_UserPaperList]
AS SELECT distinct    [dbo].[Users].[UserID],         
        [dbo].[Users].[UserName],
                          [dbo].[Users].[DepartmentId],
                          [dbo].[Department].[DepartmentId],
                           [dbo].[Department].[DepartmentName],
        [dbo].[UserAnswer].[UserID],
        [dbo].[UserAnswer].[PaperID],
        [dbo].[UserAnswer].[ExamTime],
        [dbo].[Paper].[PaperName],
                           [dbo].[Paper].[PaperState] as state
FROM         [dbo].[Users],[dbo].[Department],[dbo].[UserAnswer],[dbo].[Paper]
where Users.DepartmentId=Department.DepartmentId and Users.UserID=UserAnswer.UserID and UserAnswer.PaperID=Paper.PaperID
GO


添加完后就是一条一条的记录,用gridview现实的,每条后面有一个删除键,非得用存储进程写,拜求各位帮忙写一下这个存储过程怎么写 ?谢谢啦!

------解决方案--------------------
SQL code

create procedure p_delete
(@userid nvarchar(50),
@paperid nvarchar(50)
)
as
begin
 delete from user where userid=@userid ;
 delete from paper where paperid=@paperid;
 
end