Value の読み込み時に使用する DataRowVersion を取得または設定します。
Public Overridable Property SourceVersion As DataRowVersion _ Implements IDataParameter.SourceVersion
[C#]
public virtual DataRowVersion SourceVersion {get; set;}
[C++]
public: __property virtual DataRowVersion get_SourceVersion();public: __property virtual void set_SourceVersion(DataRowVersion);
[JScript]
public function get SourceVersion() : DataRowVersion;public function set SourceVersion(DataRowVersion);
プロパティ値
DataRowVersion 値の 1 つ。既定値は Current です。
実装
例外
例外の種類 | 条件 |
---|---|
ArgumentException | プロパティが、 DataRowVersion 値に設定されませんでした。 |
解説
Update 操作中に、 UpdateCommand は、このプロパティを使用して、パラメータ値が元の値と現在の値のどちらに設定されているかを判断します。これによって、主キーの更新が可能になります。このプロパティは、 Item プロパティ、または DataRow オブジェクトの GetChildRows メソッドが使用する、 DataRow のバージョンに設定されます。
使用例
[Visual Basic, C#, C++] SqlParameter を作成し、そのプロパティの一部を設定する例を次に示します。
Public Sub CreateSqlParameter()
Dim myParameter As New SqlParameter("@Description", SqlDbType.VarChar)
myParameter.IsNullable = True
myParameter.SourceColumn = "Description"
myParameter.SourceVersion = DataRowVersion.Current
myParameter.Direction = ParameterDirection.Output
End Sub 'CreateSqlParameter
[C#]
public void CreateSqlParameter()
{
SqlParameter myParameter = new SqlParameter("@Description", SqlDbType.VarChar);
myParameter.IsNullable = true;
myParameter.SourceColumn = "Description";
myParameter.SourceVersion = DataRowVersion.Current;
myParameter.Direction = ParameterDirection.Output;
}
[C++]
public:
void CreateSqlParameter()
{
SqlParameter* myParameter = new SqlParameter(S"@Description", SqlDbType::VarChar);
myParameter->IsNullable = true;
myParameter->SourceColumn = S"Description";
myParameter->SourceVersion = DataRowVersion::Current;
myParameter->Direction = ParameterDirection::Output;
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
SqlParameter クラス | SqlParameter メンバ | System.Data.SqlClient 名前空間