Export (0) Print
Expand All

IDataParameter.ParameterName Property

Gets or sets the name of the IDataParameter.

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

Property Value

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

Remarks

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

Example

[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

[C#] 
public void CreateSqlParameter() 
 {
    SqlParameter myParameter = new SqlParameter();
    myParameter.ParameterName = "@Description";
    myParameter.IsNullable = true;
    myParameter.DbType = DbType.String;
    myParameter.Direction = ParameterDirection.Output;
 }

[C++] 
public:
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.

Requirements

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

Show:
© 2014 Microsoft