In my data layer class, I initialize a parameter like so:
private int? _DependencyID; public int? DependencyID { get {return _DependencyID;} set {_DependencyID
You need to add an object:
object
cmd.AddWithValue("@DependencyID", _DependencyID == null? DBNull.Value : (object)_DependencyID);
You can shorten that to
cmd.AddWithValue("@DependencyID", (object)_DependencyID ?? DBNull.Value);