This documentation is archived and is not being maintained.

SqlParameter.SourceColumn Property

Gets or sets the name of the source column that is mapped to the DataSet and used for loading or returning the Value.

[Visual Basic]
Public Overridable Property SourceColumn As String  Implements _
public virtual string SourceColumn {get; set;}
public: __property virtual String* get_SourceColumn();
public: __property virtual void set_SourceColumn(String*);
public function get SourceColumn() : String;
public function set SourceColumn(String);

Property Value

The name of the source column that is mapped to the DataSet. The default is an empty string.




When SourceColumn is set to anything other than an empty string, the value of the parameter is retrieved from the column with the SourceColumn name. If Direction is set to Input, the value is taken from the DataSet. If Direction is set to Output, the value is taken from the data source. A Direction of InputOutput is a combination of both.

For more information about using the SourceColumn property, see Using Parameters with a DataAdapter and Updating the Database with a DataAdapter and the DataSet.


[Visual Basic, C#, C++] The following example creates a SqlParameter and sets some of its properties.

[Visual Basic] 
Public Sub CreateSqlParameter()
    Dim myParameter As New SqlParameter("@Description", SqlDbType.VarChar)
    myParameter.IsNullable = True
    myParameter.Direction = ParameterDirection.Output
    myParameter.SourceColumn = "Description"
End Sub 'CreateSqlParameter

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

void CreateSqlParameter() 
    SqlParameter* myParameter = new SqlParameter(S"@Description", SqlDbType::VarChar);
    myParameter->IsNullable = true;
    myParameter->Direction = ParameterDirection::Output;
    myParameter->SourceColumn = S"Description";

[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

SqlParameter Class | SqlParameter Members | System.Data.SqlClient Namespace