I am trying to pass `null` value to image database field if the `ImageByteArray` is not provided to `Parameters.Add` as shown here

```
cmd.Parameters.Add(new SqlParameter("@Img", SqlDbType.Image)).Value =
    DBNull.Value ? null : ImageByteArray;

```

but I am getting error that says 

> 
> Cannot implicitly convert type 'System.DBNull' to 'bool'
> 
> 
> 

first is that correct way to do it > 

if yes the how to pass `null` value if the `ImageByteArray` is not provided ?

i do not know if am right what i want to do is passing null to the parameter if the Byte Array is not provided so I avoid the `Procedure or function expects parameter '@img', which was not supplied.`