SqlPipe 类 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
允许托管存储过程在 SQL Server 数据库上进行进程内运行,以便将结果返回调用方。 此类不能被继承。
public ref class SqlPipe sealed
	public sealed class SqlPipe
	type SqlPipe = class
	Public NotInheritable Class SqlPipe
		- 继承
 - 
				SqlPipe
 
示例
以下示例使用 SqlConnection 和 SqlCommand 从存储过程中的数据源中选择行。 然后,该示例使用 a SqlPipe 执行命令并将结果发送回客户端。
[Microsoft.SqlServer.Server.SqlProcedure()]
public static void StoredProcExecuteCommand(int rating)
{
    // Connect through the context connection.
    using (SqlConnection connection = new SqlConnection("context connection=true"))
    {
        connection.Open();
        SqlCommand command = new SqlCommand(
            "SELECT VendorID, AccountNumber, Name FROM Purchasing.Vendor " +
            "WHERE CreditRating <= @rating", connection);
        command.Parameters.AddWithValue("@rating", rating);
        // Execute the command and send the results directly to the client.
        SqlContext.Pipe.ExecuteAndSend(command);
    }
}
<Microsoft.SqlServer.Server.SqlProcedure()> _
Public Shared Sub StoredProcExecuteCommand(ByVal rating As Integer)
    Dim command As SqlCommand
    ' Connect through the context connection
    Using connection As New SqlConnection("context connection=true")
        connection.Open()
        command = New SqlCommand( _
            "SELECT VendorID, AccountNumber, Name FROM Purchasing.Vendor " & _
            "WHERE CreditRating <= @rating", connection)
        command.Parameters.AddWithValue("@rating", rating)
        ' Execute the command and send the results directly to the client
        SqlContext.Pipe.ExecuteAndSend(command)
    End Using
End Sub
	注解
此类的实例通过 Pipe 类的属性 SqlContext 提供给托管存储过程。
属性
| IsSendingResults |  
		 获取一个值,该值指示 SqlPipe 是否处于将单个结果集发送回客户端的模式。 此属性是只读的。  | 
        	
方法
| Equals(Object) | 
		   确定指定对象是否等于当前对象。 (继承自 Object) | 
        	
| ExecuteAndSend(SqlCommand) |  
		 执行作为参数传递的命令,并将结果发送到客户端。  | 
        	
| GetHashCode() | 
		   作为默认哈希函数。 (继承自 Object) | 
        	
| GetType() | 
		   获取当前实例的 Type。 (继承自 Object) | 
        	
| MemberwiseClone() | 
		   创建当前 Object 的浅表副本。 (继承自 Object) | 
        	
| Send(SqlDataReader) |  
		 将多行结果集直接发送到客户端或当前输出使用者。  | 
        	
| Send(SqlDataRecord) |  
		 将单行结果集直接发送到客户端或当前输出使用者。  | 
        	
| Send(String) |  
		 将字符串消息直接发送到客户端或当前输出使用者。  | 
        	
| SendResultsEnd() |  
		 标记结果集的结尾,并将 SqlPipe 实例返回到初始状态。  | 
        	
| SendResultsRow(SqlDataRecord) |  
		 将单行数据发送回客户端。  | 
        	
| SendResultsStart(SqlDataRecord) |  
		 标记要发送到客户端的结果集的开始,并使用记录参数构造描述结果集的元数据。  | 
        	
| ToString() | 
		   返回表示当前对象的字符串。 (继承自 Object) |