2010-08-27 37 views

回答

1

您需要的OUTPUT參數

create procedure p1(@n1 int =0 OUTPUT) as 
begin 
    select 
     @n1=count(*) 
    from 
     Employee 

    select top 100 
     * 
    from 
     Employee 
end 

- 兼記住,你必須表明參數是當你執行PROC

Declare @val int 
exec p1 @val OUTPUT 
0

解決輸出:

//I can access the resultset as following: 
var emps = dataContext1.p1; 

//I can get to @n1 by this: 
int i1=int(emps).ReturnValue; 
相關問題