This documentation is archived and is not being maintained.

IDataParameter.SourceVersion Property

Gets or sets the DataRowVersion to use when loading Value.

[Visual Basic]
Property SourceVersion As DataRowVersion
DataRowVersion SourceVersion {get; set;}
__property DataRowVersion get_SourceVersion();
__property void set_SourceVersion(DataRowVersion);
function get SourceVersion() : DataRowVersion;function set SourceVersion(DataRowVersion);

Property Value

One of the DataRowVersion values. The default is Current.


Exception Type Condition
ArgumentException The property was not set one of the DataRowVersion values.


This property is used by the UpdateCommand during the Update to determine whether the original or current value is used for a parameter value. This allows primary keys to be updated. This property is ignored by the InsertCommand and DeleteCommand. This property is set to the version of the DataRow used by the Item property, or the GetChildRows method of the DataRow object.


[Visual Basic, C#, C++] The following example creates an instance of the implementing class, SqlParameter, and sets some of its properties.

[Visual Basic] 
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

public void CreateSqlParameter() 
    SqlParameter myParameter = new SqlParameter("@Description", SqlDbType.VarChar);
    myParameter.IsNullable = true;
    myParameter.SourceColumn = "Description";
    myParameter.SourceVersion = DataRowVersion.Current;
    myParameter.Direction = ParameterDirection.Output;

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] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

IDataParameter Interface | IDataParameter Members | System.Data Namespace