SqlParameter.ParameterName Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the name of the SqlParameter.
public:
virtual property System::String ^ ParameterName { System::String ^ get(); void set(System::String ^ value); };
C#
public override string ParameterName { get; set; }
member this.ParameterName : string with get, set
Public Overrides Property ParameterName As String
The name of the SqlParameter. The default is an empty string.
The following example creates a SqlParameter and sets some of its properties.
C#
using Microsoft.Data.SqlClient;
class Program
{
private static void AddSqlParameter(SqlCommand command)
{
SqlParameter parameter = new SqlParameter();
parameter.ParameterName = "@Description";
parameter.IsNullable = true;
parameter.DbType = DbType.String;
parameter.Direction = ParameterDirection.Output;
command.Parameters.Add(parameter);
}
}
The ParameterName is specified in the form @paramname. You must set ParameterName before executing a SqlCommand that relies on parameters.
Product | Versions |
---|---|
SqlClient .NET Core | 1.0, 1.1, 2.0, 2.1, 3.0, 3.1, 4.0, 4.1, 5.0, 5.1, 5.2 |
SqlClient .NET Framework | 1.0, 1.1, 2.0, 2.1, 3.0, 3.1, 4.0, 4.1, 5.0, 5.1, 5.2 |
SqlClient .NET Standard | 1.0, 1.1, 2.0, 2.1, 3.0, 3.1, 4.0, 4.1, 5.0, 5.1, 5.2 |