ParameterDirection中的参数(Input,Output,InputOutput,ReturnValue)

ParameterDirection中的参数类型定义,首先看ParameterDirection定义

 1     // 摘要:
 2     //     指定查询内的有关 System.Data.DataSet 的参数的类型。
 3     public enum ParameterDirection
 4     {
 5         // 摘要:
 6         //     参数是输入参数。
 7         Input = 1,
 8         //
 9         // 摘要:
10         //     参数是输出参数。
11         Output = 2,
12         //
13         // 摘要:
14         //     参数既能输入,也能输出。
15         InputOutput = 3,
16         //
17         // 摘要:
18         //     参数表示诸如存储过程、内置函数或用户定义函数之类的操作的返回值。
19         ReturnValue = 6,
20     }

可能Output和ReturnValue容易混淆

看下存储过程

 1 USE [APS_Future_FT]
 2 GO
 3 /****** Object:  StoredProcedure [dbo].[A_002]    Script Date: 2013/11/11 14:30:00 ******/
 4 SET ANSI_NULLS ON
 5 GO
 6 SET QUOTED_IDENTIFIER ON
 7 GO
 8 -- =============================================
 9 -- Author:        <Author,,Name>
10 -- Create date: <Create Date,,>
11 -- Description:    <Description,,>
12 -- =============================================
13 ALTER PROCEDURE [dbo].[A_002]
14      (
15         @outputParameter INT OUTPUT
16      )
17 AS
18 BEGIN
19     -- SET NOCOUNT ON added to prevent extra result sets from
20     -- interfering with SELECT statements.
21     SET NOCOUNT ON;
22 
23     SET @outputParameter = 100 
24 
25     RETURN 101
26 
27 
28 END

其中,100就是ParameterDirection类中定义的Output类型的参数

101就是对应的 ReturnValue类型 

原文地址:https://www.cnblogs.com/qizhelongdeyang/p/3417892.html