dbBindTimeParam

Top  Previous  Next

Syntax

INT = dbBindTimeParam(hstmt as INT,param as INT,tm as DBTIME)

Description

Binds a DBTIME variable to be used as a parameter in a prepared SQL statement.

Parameters

hstmt - A statement handle returned by dbPrepareSQL.

param - The ones based parameter number to bind.

tm - A UDT of type DBTIME

Return value

TRUE if variable bound successfully, FALSE otherwise.

Remarks

A parameter is denoted by a ? in the SQL statement. There must be exactly one bound variable for each parameter.

Example usage

DEF tm as DBTIME
hstmt = dbPrepareSQL(pdb,"INSERT INTO Addresses (FirstName,LastName,Address,tmAdded) VALUES(?,?,?,?)")
IF hstmt
    dbBindParameter(hstmt,1,first,255)
    dbBindParameter(hstmt,2,last,255)
    dbBindParameter(hstmt,3,street,255)
    dbBindTimeParam(hstmt,4,tm)
    'after the variables are bound you can insert as many records as needed with one statement
    first = "Lisa"
    last = "Jones"
    street = "123 Niagara"
    tm.hour = 12:tm.minute = 0:tm.second = 0
    dbExecute(hstmt)
    '
    first = "Tammy"
    last = "Miller"
    street = "123 Blah Blah"
    tm.hour = 9:tm.minute = 35:tm.second = 0
    dbExecute(hstmt)
    '
    dbFreeSQL(hstmt)
ENDIF