SqlContextとは? わかりやすく解説

SqlContext クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

呼び出し元のコンテキストを抽象化し、SqlPipe、SqlTriggerContext、WindowsIdentity の各オブジェクトへのアクセスを提供します。このクラスは継承できません。

名前空間: Microsoft.SqlServer.Server
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public NotInheritable Class
 SqlContext
public sealed class SqlContext
public final class SqlContext
解説解説
使用例使用例

次の例では、新しい SqlDataRecord と、その SqlMetaData オブジェクトを作成します。さらに、SendResultsStart メソッドで結果セットの先頭を宣言し、サンプルのデータを含むレコードを、SendResultsRow メソッドでクライアントに返した後、結果セットの最後に到達したことを、SendResultsEnd メソッドを使って示しています。

<Microsoft.SqlServer.Server.SqlProcedure()> _
Public Shared Sub StoredProcReturnResultSet()

    ' Create the record and specify the metadata for the columns.
    Dim record As New SqlDataRecord(
 _
        New SqlMetaData("col1",
 SqlDbType.NVarChar, 100), _
        New SqlMetaData("col2",
 SqlDbType.Int))

    ' Mark the begining of the result-set.
    SqlContext.Pipe.SendResultsStart(record)

    ' Send 10 rows back to the client.
    Dim i As Integer
    For i = 0 To 9

        ' Set values for each column in the row.
        record.SetString(0, "row " & i.ToString())
        record.SetInt32(1, i)

        ' Send the row back to the client.
        SqlContext.Pipe.SendResultsRow(record)
    Next

    ' Mark the end of the result-set.
    SqlContext.Pipe.SendResultsEnd()
End Sub
[Microsoft.SqlServer.Server.SqlProcedure]
public static void StoredProcReturnResultSet()
{
    // Create the record and specify the metadata for the columns.
    SqlDataRecord record = new SqlDataRecord(
        new SqlMetaData("col1", SqlDbType.NVarChar,
 100),
        new SqlMetaData("col2", SqlDbType.Int));

    // Mark the begining of the result-set.
    SqlContext.Pipe.SendResultsStart(record);

    // Send 10 rows back to the client.
    for (int i = 0; i < 10; i++)
    {
        // Set values for each column in the row.
        record.SetString(0, "row " + i.ToString());
        record.SetInt32(1, i);

        // Send the row back to the client.
        SqlContext.Pipe.SendResultsRow(record);
    }

    // Mark the end of the result-set.
    SqlContext.Pipe.SendResultsEnd();
}
継承階層継承階層
System.Object
  Microsoft.SqlServer.Server.SqlContext
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SqlContext メンバ
Microsoft.SqlServer.Server 名前空間

SqlContext プロパティ


SqlContext メソッド


SqlContext メンバ

呼び出し元のコンテキストを抽象化し、SqlPipe、SqlTriggerContext、WindowsIdentity の各オブジェクトへのアクセスを提供します。このクラスは継承できません。

SqlContext データ型で公開されるメンバを以下の表に示します。


パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

SqlContext クラス
Microsoft.SqlServer.Server 名前空間



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「SqlContext」の関連用語

SqlContextのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SqlContextのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS