Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8858809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:54:46+00:00 2026-06-14T14:54:46+00:00

I am attempting to write a number of records back to the database from

  • 0

I am attempting to write a number of records back to the database from a VB6 application using ADO. The records were read in from the database into an ADODB.Recordset and subsequently updated. I would like to be able to have each record in the set use the current date and time of the database server because I have no confidence that all our machines are time-synchronized. Is there a way to do this without having to query the database for CURRENT_TIMESTAMP (or something similar)? Ideally I’m hoping for some sort of flag that I can set the field value to so that the Recordset works this out on the database server.

See the question in my prototype code below (within the while-loop).

Dim oConn As ADODB.Connection
Dim oRs As ADODB.Recordset
Dim sSQL As String
Dim sColumnName1 As String: sColumnName1 = "UserNID"
Dim sColumnName2 As String: sColumnName2 = "Username"
Dim sColumnName3 As String: sColumnName3 = "LastLoginDTM"

' Open a connection.
Set oConn = New ADODB.Connection
oConn.Open 'my connection string was here

' Make a query over the connection.
sSQL = "SELECT TOP 10 " & sColumnName1 & ", " & sColumnName2 & ", " & sColumnName3 & " " & _
       "FROM theTable"

Set oRs = New ADODB.Recordset
oRs.CursorLocation = adUseClient
oRs.Open sSQL, oConn, adOpenStatic, adLockBatchOptimistic, adCmdText
oRs.MoveFirst

While Not oRs.EOF
    oRs.Fields(sColumnName3).Value = '-=-=-=-=-What do I put here???-=-=-=-=-
    oRs.MoveNext
Wend

' Close the connection.
oConn.Close
Set oConn = Nothing
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:54:47+00:00Added an answer on June 14, 2026 at 2:54 pm

    You could use the TSQL GetDate() Function

    Change your Select to:

    sSQL = "SELECT TOP 10 " & sColumnName1 & ", " & sColumnName2 & _ 
            ", " & sColumnName3 & ", GETDATE() AS ServerTimeStamp " & _
           "FROM theTable"
    

    Then, your code could be:

    While Not oRs.EOF
        oRs.Fields(sColumnName3).Value = oRS.Fields("ServerTimeStamp").Value
        oRs.MoveNext
    Wend
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to write a function that recursively computes the resulting fibonacci number from
I'm attempting to write a program in Linux using C++ that counts the number
I am attempting to write an Android app which will allow me to read
I'm attempting to write a very basic script using javascript. What I want to
i'm attempting to write the result of the $x = [System.Net.Dns]::GetHostAddresses($name) statement into my
I have been attempting to write a program that will determine if a number
I'm attempting to write a genetic algorithm framework in Python, and am running into
I'm attempting to write a GUI searchable bacteria database with the database array embedded
I'm attempting to write an image processing library in Clojure, but I've run into
I am attempting to run a number of student FORTRAN programs from a python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.