Setting default value for DateTime field

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
 
S

Sushil Chordia

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()+")"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top