This is the code generated by the designer:
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.DateTime dcDateOfPayment {
get {
try {
return ((global::System.DateTime)(this[this.tabledtAllInvoices.dcDateOfPaymentColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'dcDateOfPayment\' in table \'dtAllInvoices\' is DBNull.", e);
}
}
set {
this[this.tabledtAllInvoices.dcDateOfPaymentColumn] = value;
}
}
Whenever the value is null it goes into the catch and then the exception is re thrown. Right now I modify the designer file every time it is regenerated. But its quite pain and sometimes I forget.
Any way around this?
Thanks.