Forums
This topic is locked
insert current date in SQL database from form
Posted 02 Apr 2002 00:37:01
1
has voted
02 Apr 2002 00:37:01 Dennis Carpenter posted:
What value do I place in a form field so that it will insert the current date into the SQL database automatically when the form submits. Replies
Replied 02 Apr 2002 01:00:43
02 Apr 2002 01:00:43 Owen Eastwick replied:
Two options:
1. Make the default value of the textfied <%= Date %> like this:
<input type="text" value="<%= Date %>">
2. If you want to add the date automatically when a record is first inserted, create a field in the database table with a data type of DateTime then make its default value getdate(). This will put the current date in this field whenever a record is added. So when inserting a new record from your web page insert all the fields but the date. The database will fill the date in for you, this is a more efficient way of doing it.
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
1. Make the default value of the textfied <%= Date %> like this:
<input type="text" value="<%= Date %>">
2. If you want to add the date automatically when a record is first inserted, create a field in the database table with a data type of DateTime then make its default value getdate(). This will put the current date in this field whenever a record is added. So when inserting a new record from your web page insert all the fields but the date. The database will fill the date in for you, this is a more efficient way of doing it.
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo