When my webpage add a new record into database, it will update some fields
automatically without user interaction. This update is done before the business object
insert the new record into database.
For example, I have a business object called 'Order', which bind to order table. The
order table has a field called 'orderDate'. When the user adds new order, my
application will automatically set the orderDate to today's date. Then save the record
into database using business object. I tried to update the orderDate value in business
object entity. The code as below:
order.Entity.orderDate = Now.Date
But it causes runtime error. Below is the error message shown in web page.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and where
it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 33: End Get
Line 34: Set(ByVal value As String)
Line 35: Me.Row("orderDate") = value
Line 36: End Set
Line 37: End Property
What is the correct way to update the data before saving? Thanks.