PdcDBQuery.SetParamStr

From External Bemet Wiki
Revision as of 15:29, 31 October 2019 by TC (talk | contribs) (Created page with "== Declaration == SetParamStr(ParameterName as string, Value as string) 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

SetParamStr(ParameterName as string, Value as string) 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"
  objQuery.SetParamStr  "ParamOne", "Amsterdam"
  objQuery.SetParamBool "ParamTwo", True
  
  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)