Group: Forum Members
Posts: 5,
Visits: 16
|
Working through the tutorial and got the CustomerMaintenance form up and running. However when I click on "New" an InvalidCastException is thrown.
Exception message states "Unable to cast object of type 'System.DBNull' to type 'System.String'." Offending line of code is in the 'get' accessor for the CustomerID field and reads - "[font=Courier New]return (System.String)this.CurrentRow["CustomerID"];[/font]".
I know I can put in some code in the get accessor to check for DbNull but was just wondering if there is a property or something that can be set to true so that the generated code will automatically account for null scenarios.
|