ParameterName Property

IDataParameter.ParameterName Property


Gets or sets the name of the IDataParameter.

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

string ParameterName { get; set; }

Property Value

Type: System.String

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.

The following example creates an instance of the implementing class, SqlParameter, and sets some of its properties.

private static void AddSqlParameter(SqlCommand command)
    SqlParameter parameter = new SqlParameter();
    parameter.ParameterName = "@Description";
    parameter.IsNullable = true;
    parameter.DbType = DbType.String;
    parameter.Direction = ParameterDirection.Output;


.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft