dcsimg
Results 1 to 5 of 5

Thread: save mysql timestamp

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2013
    Posts
    1,126

    save mysql timestamp

    How do you save a timestamp in mysql database?

    I am trying to execute

    rs.addnew
    rs.fields("timestamp")=now()
    rs.update

    but no record added.


    Any ideas?

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    May 2013
    Posts
    1,126

    Re: save mysql timestamp

    I still need help. I dont find any answer googling.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,680

    Re: save mysql timestamp

    I'm not sure if they are different from MS SQL or not but... 1) you shouldn't use timestamp as the field name, as it's a type... 2) most timestamps are automatically set (I could be wrong about this) based on the change (or insert) date of the row... 3) I highly doubt you only have one field in your table, or your selection, but w/o the code for it, it's purely conjecture.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: save mysql timestamp

    Codesearcher

    This might be the problem

    Code:
    rs.addnew
    rs.fields("timestamp") = now()
    rs.update
    Maybe this will work

    Code:
    rs.addnew
    rs("timestamp") = now()
    rs.update
    Spoo

  5. #5
    PowerPoster
    Join Date
    Jun 2013
    Posts
    4,586

    Re: save mysql timestamp

    Umm, nope - no difference... each of the lines below:

    Rs!timestamp =
    Rs("timestamp") =
    Rs.Fields("timestamp") =

    are resolved by the compiler (under the hood) to its explicit, full form:

    Rs.Fields.Item("timestamp") =

    Or, to be even more precise, not leaving out the Default-Prop of the ADODB.Field-Object:

    Rs.Fields.Item("timestamp").Value = Now()

    so the above resolving is, what really happens when you type in the shortest possible form:

    Rs!timestamp = Now()

    Olaf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width