ParameterName Property

IDataParameter.ParameterName Property

Gets or sets the name of the IDataParameter.

[Visual Basic]
Property ParameterName As String
string ParameterName {get; set;}
__property String* get_ParameterName();
__property void set_ParameterName(String*);
function get ParameterName() : String;function set ParameterName(String);

Property Value

The name of the IDataParameter. The default is an empty string.


The ParameterName is specified in the form @paramname. You must set ParameterName before executing a command that relies on parameters.


[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()
    myParameter.ParameterName = "@Description"
    myParameter.IsNullable = True
    myParameter.DbType = DbType.String
    myParameter.Direction = ParameterDirection.Output
End Sub 'CreateSqlParameter

public void CreateSqlParameter() 
    SqlParameter myParameter = new SqlParameter();
    myParameter.ParameterName = "@Description";
    myParameter.IsNullable = true;
    myParameter.DbType = DbType.String;
    myParameter.Direction = ParameterDirection.Output;

void CreateSqlParameter() 
    SqlParameter* myParameter = new SqlParameter();
    myParameter->ParameterName = S"@Description";
    myParameter->IsNullable = true;
    myParameter->DbType = DbType::String;
    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

© 2016 Microsoft