SqlPipe 클래스

정의

SQL Server 데이터베이스에서 in-process 실행 중인 관리되는 저장 프로시저가 호출자에 결과를 다시 반환할 수 있도록 합니다. 이 클래스는 상속될 수 없습니다.

public ref class SqlPipe sealed
public sealed class SqlPipe
type SqlPipe = class
Public NotInheritable Class SqlPipe
상속
SqlPipe

예제

다음 예제에서는 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);
    }
}
<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가 단일 결과 집합을 클라이언트로 다시 보내는 모드에 있는지 여부를 나타내는 값을 가져옵니다. 이 속성은 읽기 전용입니다.

메서드

ExecuteAndSend(SqlCommand)

매개 변수로 전달된 명령을 실행하고 결과를 클라이언트로 보냅니다.

Send(SqlDataReader)

클라이언트나 현재 출력 소비자에게 직접 다중 행 결과 집합을 보냅니다.

Send(SqlDataRecord)

클라이언트나 현재 출력 소비자에게 직접 단일 행 결과 집합을 보냅니다.

Send(String)

클라이언트 또는 현재 출력 소비자에게 직접 문자열 메시지를 보냅니다.

SendResultsEnd()

결과 집합의 끝 부분을 표시하고 SqlPipe 인스턴스를 초기 상태로 되돌립니다.

SendResultsRow(SqlDataRecord)

데이터의 단일 행을 클라이언트로 다시 보냅니다.

SendResultsStart(SqlDataRecord)

클라이언트로 다시 보낼 결과 집합의 시작 부분을 표시하고 레코드 매개 변수를 사용하여 결과 집합을 설명하는 메타데이터를 만듭니다.

적용 대상