PdcDBQuery.SetParamDate

From External Bemet Wiki
Revision as of 09:08, 19 January 2021 by TC (talk | contribs) (Created page with "== Declaration == SetParamDate(ParameterName as string, Value as Date) as boolean == Description == Changes the value of the parameter with a specific name to 'Value'. == No...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Declaration

SetParamDate(ParameterName as string, Value as Date) as boolean

Description

Changes the value of the parameter with a specific name to 'Value'.

Notes

Changes the value of the parameter with a specific name to 'Value'. The result returns it was succesfull or not.

Code example

This code example executes a SQL statement with parameters.

Sub sExecuteQuery
dim objQuery

  set objQuery = pdc.Database.OpenQuery(pdcConData)
  objQuery.SQL = "SELECT * 
                  FROM LK_KLANT 
                  WHERE KL_PLAATS=:ParamOne AND KL_VINK1=:ParamTwo AND 
                        kl_invoer=:ParamThree AND kl_invoer=:ParamFour AND 
                        kl_dagen=:ParamFive AND kl_limiet=:ParamSix"

  objQuery.SetParamStr      "ParamOne", "Amsterdam"
  objQuery.SetParamBool     "ParamTwo", True
  objQuery.SetParamDate     "ParamThree", Date()
  objQuery.SetParamDateTime "ParamFour", Now()
  objQuery.SetParamInt      "ParamFive", 30
  objQuery.SetParamDbl      "ParamSix", 10000.0
  
  if objQuery.Execute then
    msgbox objQuery.GetField("KL_NAAM")
  else
    msgbox "Error:" & vbCrLf & pdc.LastError & vbCrLf & vbCrLf & "SQL:" & vbCrLf & objQuery.SQL
  end if
End Sub

Availability

Available since May 2019 (from version 5.5)