• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 144
  • Last Modified:

Updating date/time in access database via dreamweaver

I have a database in which a record has been inserted and the datetime field default is now()
I need to update this field with the current now() date and time when the whole record is updated but I am struggling I have tried updating the field using now() but it doesn't work can anyone help?
0
gbdreamweaver
Asked:
gbdreamweaver
  • 2
  • 2
1 Solution
 
RouchieCommented:
Not sure which language you're using, but I'd grab the new datetime value in the web page then pass it onto access as part of the update statement.

In asp.net, it's

Dim dateTimeValue As DateTime
dateTimeValue = DateTime.Now()
Dim updateString as string
updateString = "UPDATE myTable SET dateTimeColumn = " & dateTimeValue & " WHERE ID = " & someIDValue
0
 
gbdreamweaverAuthor Commented:
using asp and vbscript
0
 
RouchieCommented:
Okay it should be virtually the same...

Dim dateTimeValue
dateTimeValue = DateTime.Now()
Dim updateString as string
' ... database connection code here
updateString = "UPDATE myTable SET dateTimeColumn = " & dateTimeValue & " WHERE ID = " & someIDValue
' ... database command executed as normal here

If you can send me your existing update statement and surrounding code I can apply this example to it.
0
 
Onyx23Commented:

As Rouchie stated - neeed to know what language you're using.
However...

If you are using mySQL database table with a column field datatype of datetime
you set up the original create table statement SIMILAR to this:


 create table your_metadata (your_record_entered datetime default 'now()' )

Then try using a timestamp so that the TIME updated every time the record is updated.

Example:

your_record_entered timestamp(15) NOT NULL

Hope this helps!
0
 
gbdreamweaverAuthor Commented:
Sorry for the delay in replying - answer perfect - just been a bit under the weather - thank you
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now