I have the following C# code:
sqlCommand.Parameters.AddWithValue("@Parameter", table.Value ?? DBNull.Value);
But it throws the following compilation error:
Operator
??
cannot be applied to operands of typestring
andSystem.DBNull
Why doesn't the compiler allow this syntax?
??
operator expects to have the same type in each side? – Baldheaded