If I want to insert into a database column of type char(2) from C#. What data type would I use in C#?
If using the following code:
private static SqlParameter addParameterValue(string parameterName, ? parameterValue, SqlCommand command)
{
SqlParameter parameter = new SqlParameter(parameterName, SqlDbType.Char);
parameter.Value = parameterValue;
command.Parameters.Add(parameter);
return parameter;
}
What type would I give to parameterValue?
I already have method like this when the parameterValue is of type string, so this could be a problem when telling the difference between SqlDbType.Char and SqlDbType.Varchar
See Question&Answers more detail:os