Linq to sql:带返回值的存储过程

来源:互联网 发布:炫彩表白软件 编辑:程序博客网 时间:2024/05/17 02:13
带返回值的存储过程

再来创建第三个存储过程:


create proc [dbo].[sp_withreturnvalue]


@customerid nchar(5)


as


set nocount on
 
if exists (select 1 from customers where customerid = @customerid)


return 101


else


return 100


生成方法后,可以通过下面的代码进行测试:




        Response.Write(ctx.sp_withreturnvalue(""));


        Response.Write(ctx.sp_withreturnvalue("ALFKI"));


运行后程序输出“100101”


原创粉丝点击