SqlPipe 类学习

SqlPipe 类
通过 SqlContext 类的 Pipe 属性,托管存储过程可以使用此类的实例。
下面的示例在存储过程中使用 SqlConnectionSqlCommand 从数据源选择行。然后此示例使用 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);
            
        }
System . . :: .Object
   Microsoft.SqlServer.Server..::.SqlPipe
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。

.NET Framework

受以下版本支持:3.5、3.0、2.0

本文出自 “西域行者” 博客,转载请与作者联系!

你可能感兴趣的:(数据库,.net,职场,framework,休闲)