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

SqlParameter クラス

SqlCommand のパラメータと、オプションで DataSet 列に対するマップを表します。このクラスは継承できません。

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

Public NotInheritable Class
 SqlParameter
    Inherits DbParameter
    Implements IDbDataParameter, IDataParameter, ICloneable
public sealed class SqlParameter : DbParameter,
 IDbDataParameter, IDataParameter, ICloneable
public ref class SqlParameter sealed : public
 DbParameter, IDbDataParameter, IDataParameter, ICloneable
public final class SqlParameter extends DbParameter
 implements IDbDataParameter, IDataParameter, 
    ICloneable
public final class SqlParameter extends
 DbParameter implements IDbDataParameter, IDataParameter, 
    ICloneable
解説解説
使用例使用例

SqlDataAdapter の SqlParameterCollection コレクションを使用して、SqlParameter の複数のインスタンスを作成する例を次に示します。これらのパラメータは、データ ソースからのデータの選択と、DataSet へのデータの設定に使用されます。この例は、DataSet および SqlDataAdapter が、正しいスキーマ、コマンド、および接続で既に作成されていることを前提にしています。

Public Sub AddSqlParameters()
    ' ...
    ' create categoriesDataSet and categoriesAdapter
    ' ...
    categoriesAdapter.SelectCommand.Parameters.Add( _
        "@CategoryName", SqlDbType.VarChar, 80).Value
 = "toasters"
    categoriesAdapter.SelectCommand.Parameters.Add( _
        "@SerialNum", SqlDbType.Int).Value = 239
    
    categoriesAdapter.Fill(categoriesDataSet)
End Sub  
public void AddSqlParameters() 
{
// ...
// create categoriesDataSet and categoriesAdapter
// ...

  categoriesAdapter.SelectCommand.Parameters.Add(
    "@CategoryName", SqlDbType.VarChar, 80).Value = "toasters";
  categoriesAdapter.SelectCommand.Parameters.Add(
    "@SerialNum", SqlDbType.Int).Value = 239;
  categoriesAdapter.Fill(categoriesDataSet);

}
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.Data.Common.DbParameter
      System.Data.SqlClient.SqlParameter
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SqlParameter メンバ
System.Data.SqlClient 名前空間
SqlParameterCollection
SqlCommand クラス

SqlParameter コンストラクタ ()

SqlParameter クラスの新しいインスタンスを初期化します。

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

public SqlParameter ()
public:
SqlParameter ()
public SqlParameter ()
public function SqlParameter ()
使用例使用例

SqlParameter を作成し、そのプロパティの一部を設定する例を次に示します。

Private Sub AddSqlParameter(ByVal
 command As SqlCommand)

    Dim parameter As New
 SqlParameter()
    With parameter
        .ParameterName = "@Description"
        .IsNullable = True
        .SqlDbType = SqlDbType.VarChar
        .Direction = ParameterDirection.Output
        .Size = 88
    End With

    command.Parameters.Add(parameter)
End Sub
private static void AddSqlParameter(SqlCommand
 command)
{
    SqlParameter parameter = new SqlParameter();
    parameter.ParameterName = "@Description";
    parameter.IsNullable = true;
    parameter.SqlDbType = SqlDbType.VarChar;
    parameter.Direction = ParameterDirection.Output;
    parameter.Size = 88;

    command.Parameters.Add(parameter);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SqlParameter コンストラクタ (String, Object)

パラメータ名と新しい SqlParameter の値を指定して、SqlParameter クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    parameterName As String, _
    value As Object _
)
Dim parameterName As String
Dim value As Object

Dim instance As New SqlParameter(parameterName,
 value)
public SqlParameter (
    string parameterName,
    Object value
)
public:
SqlParameter (
    String^ parameterName, 
    Object^ value
)
public SqlParameter (
    String parameterName, 
    Object value
)
public function SqlParameter (
    parameterName : String, 
    value : Object
)

パラメータ

parameterName

割り当てるパラメータの名前。

value

SqlParameter の値を示す Object。

解説解説

value パラメータで Object を指定すると、SqlDbType は、Object の Microsoft .NET Framework 型から推論されます。

SqlParameter コンストラクタのこのオーバーロードを使用して整数のパラメータ値を指定する場合は、注意する必要があります。このオーバーロードは Object 型の value を受け取るため、次の C# の例のように、値が 0 の場合に整数値を Object 型に変換する必要があります。

Parameter = new SqlParameter("@pname", Convert.ToInt32(0));

この変換を行わないと、コンパイラは、SqlParameter (string, SqlDbType) コンストラクタ オーバーロードを呼び出そうとしていると見なします。

使用例使用例

SqlParameter を作成し、そのプロパティの一部を設定する例を次に示します。

Private Sub AddSqlParameter(ByVal
 command As SqlCommand)

    Dim parameter As New
 SqlParameter("@Description", _
        SqlDbType.VarChar, 88, "Description")
    With parameter
        .IsNullable = True
        .Direction = ParameterDirection.Output
    End With

    command.Parameters.Add(parameter)
End Sub
private static void AddSqlParameter(SqlCommand
 command)
{
    SqlParameter parameter = new SqlParameter("@Description",
 
        SqlDbType.VarChar, 88, "Description");
    parameter.IsNullable = true;
    parameter.Direction = ParameterDirection.Output;

    command.Parameters.Add(parameter);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SqlParameter コンストラクタ (String, SqlDbType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object)

パラメータ名、パラメータの種類、パラメータのサイズ、ParameterDirection、パラメータの精度、パラメータのスケール、ソース列、使用する DataRowVersion、およびパラメータの値を指定して、SqlParameter クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    parameterName As String, _
    dbType As SqlDbType, _
    size As Integer, _
    direction As ParameterDirection, _
    isNullable As Boolean, _
    precision As Byte, _
    scale As Byte, _
    sourceColumn As String, _
    sourceVersion As DataRowVersion, _
    value As Object _
)
Dim parameterName As String
Dim dbType As SqlDbType
Dim size As Integer
Dim direction As ParameterDirection
Dim isNullable As Boolean
Dim precision As Byte
Dim scale As Byte
Dim sourceColumn As String
Dim sourceVersion As DataRowVersion
Dim value As Object

Dim instance As New SqlParameter(parameterName,
 dbType, size, direction, isNullable, precision, scale, sourceColumn, sourceVersion,
 value)
public SqlParameter (
    string parameterName,
    SqlDbType dbType,
    int size,
    ParameterDirection direction,
    bool isNullable,
    byte precision,
    byte scale,
    string sourceColumn,
    DataRowVersion sourceVersion,
    Object value
)
public:
SqlParameter (
    String^ parameterName, 
    SqlDbType dbType, 
    int size, 
    ParameterDirection direction, 
    bool isNullable, 
    unsigned char precision, 
    unsigned char scale, 
    String^ sourceColumn, 
    DataRowVersion sourceVersion, 
    Object^ value
)
public SqlParameter (
    String parameterName, 
    SqlDbType dbType, 
    int size, 
    ParameterDirection direction, 
    boolean isNullable, 
    byte precision, 
    byte scale, 
    String sourceColumn, 
    DataRowVersion sourceVersion, 
    Object value
)
public function SqlParameter (
    parameterName : String, 
    dbType : SqlDbType, 
    size : int, 
    direction : ParameterDirection, 
    isNullable : boolean, 
    precision : byte, 
    scale : byte, 
    sourceColumn : String, 
    sourceVersion : DataRowVersion, 
    value : Object
)

パラメータ

parameterName

割り当てるパラメータの名前。

dbType

SqlDbType 値の 1 つ。

size

パラメータの長さ。

direction

ParameterDirection 値の 1 つ。

isNullable

フィールドの値を null にできる場合は true。それ以外の場合は false。

precision

Value を解決するための、小数点の左右の合計桁数。

scale

Value を解決するための、小数部の桁数。

sourceColumn

ソース列の名前。

sourceVersion

DataRowVersion 値の 1 つ。

value

SqlParameter の値を示す Object。

例外例外
解説解説
使用例使用例

SqlParameter を作成し、そのプロパティの一部を設定する例を次に示します。

Private Sub AddSqlParameter(ByVal
 command As SqlCommand)

    Dim parameter As New
 SqlParameter("@Description", _
        SqlDbType.VarChar, 11, ParameterDirection.Input, _
        True, 0, 0, "Description",
 DataRowVersion.Current, _
        "garden hose")
    parameter.IsNullable = True

    command.Parameters.Add(parameter)
End Sub
private static void AddSqlParameter(SqlCommand
 command)
{
    SqlParameter parameter = new SqlParameter("@Description",
 
        SqlDbType.VarChar, 11, ParameterDirection.Input,
        true, 0, 0, "Description", DataRowVersion.Current,
 
        "garden hose");
    parameter.IsNullable = true;

    command.Parameters.Add(parameter);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SqlParameter コンストラクタ (String, SqlDbType, Int32, String)

パラメータ名、SqlDbType、サイズ、およびソース列名を指定して、SqlParameter クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    parameterName As String, _
    dbType As SqlDbType, _
    size As Integer, _
    sourceColumn As String _
)
Dim parameterName As String
Dim dbType As SqlDbType
Dim size As Integer
Dim sourceColumn As String

Dim instance As New SqlParameter(parameterName,
 dbType, size, sourceColumn)
public SqlParameter (
    string parameterName,
    SqlDbType dbType,
    int size,
    string sourceColumn
)
public:
SqlParameter (
    String^ parameterName, 
    SqlDbType dbType, 
    int size, 
    String^ sourceColumn
)
public SqlParameter (
    String parameterName, 
    SqlDbType dbType, 
    int size, 
    String sourceColumn
)
public function SqlParameter (
    parameterName : String, 
    dbType : SqlDbType, 
    size : int, 
    sourceColumn : String
)

パラメータ

parameterName

割り当てるパラメータの名前。

dbType

SqlDbType 値の 1 つ。

size

パラメータの長さ。

sourceColumn

ソース列の名前。

例外例外
解説解説
使用例使用例

SqlParameter を作成し、そのプロパティの一部を設定する例を次に示します。

Private Sub AddSqlParameter(ByVal
 command As SqlCommand)

    Dim parameter As New
 SqlParameter("@Description", _
        SqlDbType.VarChar, 88, "Description")
    With parameter
        .IsNullable = True
        .Direction = ParameterDirection.Output
    End With

    command.Parameters.Add(parameter)
End Sub
private static void AddSqlParameter(SqlCommand
 command)
{
    SqlParameter parameter = new SqlParameter("@Description",
 
        SqlDbType.VarChar, 88, "Description");
    parameter.IsNullable = true;
    parameter.Direction = ParameterDirection.Output;

    command.Parameters.Add(parameter);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SqlParameter コンストラクタ (String, SqlDbType)

パラメータ名とデータ型を指定して、SqlParameter クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    parameterName As String, _
    dbType As SqlDbType _
)
Dim parameterName As String
Dim dbType As SqlDbType

Dim instance As New SqlParameter(parameterName,
 dbType)
public SqlParameter (
    string parameterName,
    SqlDbType dbType
)
public:
SqlParameter (
    String^ parameterName, 
    SqlDbType dbType
)
public SqlParameter (
    String parameterName, 
    SqlDbType dbType
)
public function SqlParameter (
    parameterName : String, 
    dbType : SqlDbType
)

パラメータ

parameterName

割り当てるパラメータの名前。

dbType

SqlDbType 値の 1 つ。

例外例外
解説解説
使用例使用例

SqlParameter を作成し、そのプロパティの一部を設定する例を次に示します。

Private Sub AddSqlParameter(ByVal
 command As SqlCommand, _
    ByVal paramValue As String)

    Dim parameter As New
 SqlParameter("@Description", _
        SqlDbType.VarChar)
    With parameter
        .IsNullable = True
        .Direction = ParameterDirection.Output
        .Size = 88
        .Value = paramValue
    End With

    command.Parameters.Add(parameter)
End Sub
private static void AddSqlParameter(SqlCommand
 command, string paramValue)
{
    SqlParameter parameter = new SqlParameter("@Description",
 SqlDbType.VarChar);
    parameter.IsNullable = true;
    parameter.Direction = ParameterDirection.Output;
    parameter.Size = 88;
    parameter.Value = paramValue;

    command.Parameters.Add(parameter);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SqlParameter コンストラクタ (String, SqlDbType, Int32)

パラメータ名、SqlDbType、およびサイズを指定して、SqlParameter クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    parameterName As String, _
    dbType As SqlDbType, _
    size As Integer _
)
Dim parameterName As String
Dim dbType As SqlDbType
Dim size As Integer

Dim instance As New SqlParameter(parameterName,
 dbType, size)
public SqlParameter (
    string parameterName,
    SqlDbType dbType,
    int size
)
public:
SqlParameter (
    String^ parameterName, 
    SqlDbType dbType, 
    int size
)
public SqlParameter (
    String parameterName, 
    SqlDbType dbType, 
    int size
)
public function SqlParameter (
    parameterName : String, 
    dbType : SqlDbType, 
    size : int
)

パラメータ

parameterName

割り当てるパラメータの名前。

dbType

SqlDbType 値の 1 つ。

size

パラメータの長さ。

例外例外
解説解説
使用例使用例

SqlParameter を作成し、そのプロパティの一部を設定する例を次に示します。

Private Sub AddSqlParameter(ByVal
 command As SqlCommand, _
    ByVal paramValue As String)

    Dim parameter As New
 SqlParameter("@Description", _
        SqlDbType.VarChar, 88)
    With parameter
        .IsNullable = True
        .Direction = ParameterDirection.Output
        .Value = paramValue
    End With

    command.Parameters.Add(parameter)
End Sub
private static void AddSqlParameter(SqlCommand
 command, 
    string paramValue)
{
    SqlParameter parameter = new SqlParameter("@Description",
 
        SqlDbType.VarChar, 88);
    parameter.IsNullable = true;
    parameter.Direction = ParameterDirection.Output;
    parameter.Value = paramValue;

    command.Parameters.Add(parameter);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SqlParameter コンストラクタ

SqlParameter クラスの新しいインスタンスを初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
SqlParameter () SqlParameter クラスの新しいインスタンスを初期化します。

.NET Compact Framework によってサポートされています。

SqlParameter (String, Object) パラメータ名と新しい SqlParameter の値を指定して、SqlParameter クラスの新しいインスタンスを初期化します。

.NET Compact Framework によってサポートされています。

SqlParameter (String, SqlDbType) パラメータ名とデータ型を指定して、SqlParameter クラスの新しいインスタンスを初期化します。

.NET Compact Framework によってサポートされています。

SqlParameter (String, SqlDbType, Int32) パラメータ名、SqlDbType、およびサイズを指定して、SqlParameter クラスの新しいインスタンスを初期化します。

.NET Compact Framework によってサポートされています。

SqlParameter (String, SqlDbType, Int32, String) パラメータ名、SqlDbType、サイズ、およびソース列名を指定して、SqlParameter クラスの新しいインスタンスを初期化します。

.NET Compact Framework によってサポートされています。

SqlParameter (String, SqlDbType, Int32, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object) パラメータ名、パラメータの種類、パラメータのサイズ、ParameterDirection、パラメータの精度、パラメータのスケール、ソース列、使用する DataRowVersion、およびパラメータの値を指定して、SqlParameter クラスの新しいインスタンスを初期化します。

.NET Compact Framework によってサポートされています。

SqlParameter (String, SqlDbType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object, String, String, String) パラメータ名、パラメータの型、パラメータの長さ、方向、精度、スケール、ソース列の名前、いずれかの DataRowVersion 値、ソース列マップのブール値、SqlParameter の値、この XML インスタンスのスキーマ コレクションが置かれているデータベースの名前、この XML インスタンスのスキーマ コレクションが置かれている所有リレーショナル スキーマ、およびこのパラメータのスキーマ コレクションの名前を使用する SqlParameter クラスの新しいインスタンスを初期化します。
参照参照

関連項目

SqlParameter クラス
SqlParameter メンバ
System.Data.SqlClient 名前空間

その他の技術情報

ADO.NET でのデータへの接続およびデータの取得
.NET Framework Data Provider for SQL Server の使用

SqlParameter コンストラクタ (String, SqlDbType, Int32, ParameterDirection, Byte, Byte, String, DataRowVersion, Boolean, Object, String, String, String)

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

パラメータ名、パラメータの型、パラメータの長さ、方向、精度、スケール、ソース列の名前、いずれかの DataRowVersion 値、ソース列マップのブール値、SqlParameter の値、この XML インスタンスのスキーマ コレクションが置かれているデータベースの名前、この XML インスタンスのスキーマ コレクションが置かれている所有リレーショナル スキーマ、およびこのパラメータのスキーマ コレクションの名前を使用する SqlParameter クラスの新しいインスタンスを初期化します。

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

Public Sub New ( _
    parameterName As String, _
    dbType As SqlDbType, _
    size As Integer, _
    direction As ParameterDirection, _
    precision As Byte, _
    scale As Byte, _
    sourceColumn As String, _
    sourceVersion As DataRowVersion, _
    sourceColumnNullMapping As Boolean, _
    value As Object, _
    xmlSchemaCollectionDatabase As String,
 _
    xmlSchemaCollectionOwningSchema As String,
 _
    xmlSchemaCollectionName As String _
)
Dim parameterName As String
Dim dbType As SqlDbType
Dim size As Integer
Dim direction As ParameterDirection
Dim precision As Byte
Dim scale As Byte
Dim sourceColumn As String
Dim sourceVersion As DataRowVersion
Dim sourceColumnNullMapping As Boolean
Dim value As Object
Dim xmlSchemaCollectionDatabase As String
Dim xmlSchemaCollectionOwningSchema As String
Dim xmlSchemaCollectionName As String

Dim instance As New SqlParameter(parameterName,
 dbType, size, direction, precision, scale, sourceColumn, sourceVersion, sourceColumnNullMapping,
 value, xmlSchemaCollectionDatabase, xmlSchemaCollectionOwningSchema, xmlSchemaCollectionName)
public SqlParameter (
    string parameterName,
    SqlDbType dbType,
    int size,
    ParameterDirection direction,
    byte precision,
    byte scale,
    string sourceColumn,
    DataRowVersion sourceVersion,
    bool sourceColumnNullMapping,
    Object value,
    string xmlSchemaCollectionDatabase,
    string xmlSchemaCollectionOwningSchema,
    string xmlSchemaCollectionName
)
public:
SqlParameter (
    String^ parameterName, 
    SqlDbType dbType, 
    int size, 
    ParameterDirection direction, 
    unsigned char precision, 
    unsigned char scale, 
    String^ sourceColumn, 
    DataRowVersion sourceVersion, 
    bool sourceColumnNullMapping, 
    Object^ value, 
    String^ xmlSchemaCollectionDatabase, 
    String^ xmlSchemaCollectionOwningSchema, 
    String^ xmlSchemaCollectionName
)
public SqlParameter (
    String parameterName, 
    SqlDbType dbType, 
    int size, 
    ParameterDirection direction, 
    byte precision, 
    byte scale, 
    String sourceColumn, 
    DataRowVersion sourceVersion, 
    boolean sourceColumnNullMapping, 
    Object value, 
    String xmlSchemaCollectionDatabase, 
    String xmlSchemaCollectionOwningSchema, 
    String xmlSchemaCollectionName
)
public function SqlParameter (
    parameterName : String, 
    dbType : SqlDbType, 
    size : int, 
    direction : ParameterDirection, 
    precision : byte, 
    scale : byte, 
    sourceColumn : String, 
    sourceVersion : DataRowVersion, 
    sourceColumnNullMapping : boolean, 
    value : Object, 
    xmlSchemaCollectionDatabase : String, 
    xmlSchemaCollectionOwningSchema : String, 
    xmlSchemaCollectionName : String
)

パラメータ

parameterName

割り当てるパラメータの名前。

dbType

SqlDbType 値の 1 つ。

size

パラメータの長さ。

direction

ParameterDirection 値の 1 つ。

precision

Value を解決するための、小数点の左右の合計桁数。

scale

Value を解決するための、小数部の桁数。

sourceColumn

ソース列の名前。

sourceVersion

DataRowVersion 値の 1 つ。

sourceColumnNullMapping

ソース列が null 許容の場合は true。それ以外の場合は false。

value

SqlParameter の値を示す Object。

xmlSchemaCollectionDatabase

この XML インスタンスのスキーマ コレクションが置かれているデータベースの名前。

xmlSchemaCollectionOwningSchema

この XML インスタンスのスキーマ コレクションが置かれている所有リレーショナル スキーマ。

xmlSchemaCollectionName

このパラメータのスキーマ コレクションの名前。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SqlParameter プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ DbType オーバーライドされます。 パラメータの SqlDbType を取得または設定します。
パブリック プロパティ Direction オーバーライドされます。 パラメータが入力専用、出力専用、双方向、またはストアド プロシージャの戻り値パラメータかどうかを示す値を取得または設定します。
パブリック プロパティ IsNullable オーバーライドされます。 パラメータが null 値を受け付けるかどうかを示す値を取得または設定します。
パブリック プロパティ ParameterName オーバーライドされます。 SqlParameter の名前を取得または設定します。
パブリック プロパティ Size オーバーライドされます。 列内のデータの最大サイズをバイト単位で取得または設定します。
パブリック プロパティ SourceColumn オーバーライドされます。 DataSet に割り当てられ、Value の読み込みまたは戻しに使用されるソース列の名前を取得または設定します。
パブリック プロパティ SourceColumnNullMapping オーバーライドされます。 ソース列が null 許容であるかどうかを示す値を設定または取得します。SqlCommandBuilder は、これを使用することにより、null l許容の列に対する Update ステートメントを正しく生成できます。
パブリック プロパティ SourceVersion オーバーライドされます。 Value の読み込み時に使用する DataRowVersion を取得または設定します。
パブリック プロパティ Value オーバーライドされます。 パラメータの値を取得または設定します。
パブリック プロパティ XmlSchemaCollectionDatabase この XML インスタンスのスキーマ コレクションが置かれているデータベースの名前を取得します。
パブリック プロパティ XmlSchemaCollectionName この XML インスタンスに対応するスキーマ コレクションの名前を取得します。
パブリック プロパティ XmlSchemaCollectionOwningSchema この XML インスタンスのスキーマ コレクションが置かれている所有リレーショナル スキーマ。
参照参照

関連項目

SqlParameter クラス
System.Data.SqlClient 名前空間
SqlParameterCollection
SqlCommand クラス

SqlParameter メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド CreateObjRef  リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。)
パブリック メソッド GetLifetimeService  対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド InitializeLifetimeService  対象のインスタンスの有効期間ポリシーを制御する、有効期間サービス オブジェクトを取得します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド ResetDbType オーバーライドされます。 この SqlParameter に関連付けられている型をリセットします。
パブリック メソッド ResetSqlDbType この SqlParameter に関連付けられている型をリセットします。
パブリック メソッド ToString オーバーライドされます。 ParameterName を格納する文字列を取得します。
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイスの実装
  名前 説明
インターフェイスの明示的な実装 System.ICloneable.Clone このメンバの説明については、Clone のトピックを参照してください。
参照参照

関連項目

SqlParameter クラス
System.Data.SqlClient 名前空間
SqlParameterCollection
SqlCommand クラス

SqlParameter メンバ

SqlCommand のパラメータと、オプションで DataSet 列に対するマップを表します。このクラスは継承できません。

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


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ DbType オーバーライドされます。 パラメータの SqlDbType を取得または設定します。
パブリック プロパティ Direction オーバーライドされます。 パラメータが入力専用、出力専用、双方向、またはストアド プロシージャの戻り値パラメータかどうかを示す値を取得または設定します。
パブリック プロパティ IsNullable オーバーライドされます。 パラメータが null 値を受け付けるかどうかを示す値を取得または設定します。
パブリック プロパティ ParameterName オーバーライドされます。 SqlParameter の名前を取得または設定します。
パブリック プロパティ Size オーバーライドされます。 列内のデータの最大サイズをバイト単位で取得または設定します。
パブリック プロパティ SourceColumn オーバーライドされます。 DataSet に割り当てられ、Value の読み込みまたは戻しに使用されるソース列の名前を取得または設定します。
パブリック プロパティ SourceColumnNullMapping オーバーライドされます。 ソース列が null 許容であるかどうかを示す値を設定または取得します。SqlCommandBuilder は、これを使用することにより、null l許容の列に対する Update ステートメントを正しく生成できます。
パブリック プロパティ SourceVersion オーバーライドされます。 Value の読み込み時に使用する DataRowVersion を取得または設定します。
パブリック プロパティ Value オーバーライドされます。 パラメータの値を取得または設定します。
パブリック プロパティ XmlSchemaCollectionDatabase この XML インスタンスのスキーマ コレクションが置かれているデータベースの名前を取得します。
パブリック プロパティ XmlSchemaCollectionName この XML インスタンスに対応するスキーマ コレクションの名前を取得します。
パブリック プロパティ XmlSchemaCollectionOwningSchema この XML インスタンスのスキーマ コレクションが置かれている所有リレーショナル スキーマ。
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド CreateObjRef  リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。 (MarshalByRefObject から継承されます。)
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。)
パブリック メソッド GetLifetimeService  対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド InitializeLifetimeService  対象のインスタンスの有効期間ポリシーを制御する、有効期間サービス オブジェクトを取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド ResetDbType オーバーライドされます。 この SqlParameter に関連付けられている型をリセットします。
パブリック メソッド ResetSqlDbType この SqlParameter に関連付けられている型をリセットします。
パブリック メソッド ToString オーバーライドされます。 ParameterName を格納する文字列を取得します。
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイスの実装
  名前 説明
インターフェイスの明示的な実装 System.ICloneable.Clone このメンバの説明については、Clone のトピックを参照してください。
参照参照

関連項目

SqlParameter クラス
System.Data.SqlClient 名前空間
SqlParameterCollection
SqlCommand クラス



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「SqlParameter」の関連用語

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

   

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



SqlParameterのページの著作権

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

©2026 GRAS Group, Inc.RSS