Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
Greg,
You won't be storing 1/1/1800 in the database (or you don't have to), you'll be storing NULL in the database. When you use the BO Mapper to map a datetime field to a column in the database and you use the Null option value of Return Alternate on Null / Set Null on Alternate, this sets the value of the field in the BO to the alternate value (1/1/1800 in this case), but when storing data in the database, if the value in the BO is 1/1/1800, it sends a NULL to the db for storage (See note below).
So, what the post you found (I totally forgot about that one) is saying is that you separate the property you are binding from the property you are displaying. Then you synch the display property and the binding property via events.
Let us know if you run into problems with the sub-classed TextBox.
Details of Alternate Nulls What is actually happening is that the property in the BO is referencing a column in the underlying DataTable. The property getter checks if the value in the DataTable is DbNull and if it is, it returns the alternate value. In the setter, it checks if the value being set is the alternate value and if it is, it sets the column in the DataTable to DbNull. Check out the .designer file to see what is actually happening.
|