G
Giammarco
Hi all,
I have the following code:
int? name;
SqlCommand.Parameters.AddWithValue("@Name", name);
if (SqlCommand.Parameters["@Name"].Value == null)
{
SqlCommand.Parameters["@Name"].Value = DBNull.Value;
}
Well, I do not assign any value to 'name', so it's value is null, as it
is a nullable type. However, when I check if
SqlCommand.Parameters["@Name"].Value == null, the condition is not
satisfied.
Any clue why the condition is not satisfied?
Thanks,
Giammarco
I have the following code:
int? name;
SqlCommand.Parameters.AddWithValue("@Name", name);
if (SqlCommand.Parameters["@Name"].Value == null)
{
SqlCommand.Parameters["@Name"].Value = DBNull.Value;
}
Well, I do not assign any value to 'name', so it's value is null, as it
is a nullable type. However, when I check if
SqlCommand.Parameters["@Name"].Value == null, the condition is not
satisfied.
Any clue why the condition is not satisfied?
Thanks,
Giammarco