dbGetTimeStamp

Top  Previous  Next

Syntax

dbGetTimeStamp(hstmt as INT,column as INT,timestamp as DBTIMESTAMP)

Description

Gets a DBTIMESTAMP type directly from a column after a dbGet, dbGetNext or dbGetPrev operation.

Parameters

hstmt - Statement handle returned by dbExecSQL or dbPrepareSQL.

column - Ones based column number to retrieve from.

timestamp - A variable of type DBTIMESTAMP

Return value

TRUE if data was successfully retrieved and stored in the variable. FALSE on error or empty result set.

Remarks

dbGetTimeStamp is an alternative to binding a DBTIMESTAMP variable and is not supported by all database drivers.  Certain drivers will not allow directly retrieving data from a column if it is already bound to a variable. The Access driver supports both binding and direct retrieval. Binding variables will always result in faster retrieval of data.

See Also: dbGetTime, dbGetDate, dbGetData

Example usage

DEF dtAdded as DBTIMESTAMP
DEF first,last as STRING
DEF Address_ID as INT
...
hstmt = dbExecSQL(pdb,"SELECT * FROM Addresses")
IF hStmt
    'bind the columns in the table to appropriate variables
    'column numbers start at 1 starting from the left.
   
    WHILE dbGet(hstmt)
        dbGetData(hstmt,1,Address_ID)
        dbGetData(hstmt,2,first)
        dbGetData(hstmt,3,last)
        dbGetDate(hstmt,8,dtAdded)
        PRINT "ID:",Address_ID
        PRINT "Name:",first,last
        PRINT "Date added:",USING("## ## ####",dtAdded.month,dtAdded.day,dtAdded.year)
        PRINT "Time added:",USING("## ## ##",dtAdded.hour,dtAdded.minute,dtAdded.second)
    ENDWHILE
ENDIF