Setting default value for DateTime field

  • Thread starter Thread starter Danny L
  • Start date Start date
D

Danny L

Hi,

I would like a datetime field in my dataset to always be set to the
current Date & time when a new row is added. I tried setting the
default value to DateTime.Now but that dosen't work since the function
is called only once (and not everytime a new row is added).
I am using a winforms application with bound controls.

Regards,

Danny
 
Danny, Are you trying to update the datatable with the time you are making
the update in the backend database? If thats the case, one option (without
giving much thinking) could be to specify your own InsertCommand and append
currentTime to the insert statement. "insert into test values
(@a1,@a2,"+DateTime.Now()+")"
 
Back
Top