PdcDBQuery.SetParamStr: Difference between revisions
Jump to navigation
Jump to search
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..." |
No edit summary |
||
Line 12: | Line 12: | ||
<source lang="vb"> | <source lang="vb"> | ||
Dim myQuery As PDCEXT.IDBQuery = PDC.App.Database.OpenQuery(PDCEXT.pdcConnectionKind.pdcConData) | |||
myQuery.SQL = "SELECT * FROM LK_KLANT WHERE KL_PLAATS=:ParamOne AND KL_VINK1=:ParamTwo" | |||
myQuery.SetParamStr("ParamOne", "Amsterdam") | |||
myQuery.SetParamBool("ParamTwo", True) | |||
If myQuery.Execute Then | |||
MsgBox(myQuery.GetField("KL_NAAM")) | |||
Else | |||
MsgBox($"Error: {PDC.App.LastError}") | |||
End If | |||
End | |||
</source> | </source> | ||
== Availability == | == Availability == | ||
Available since May 2019 (from version 5.5) | Available since May 2019 (from version 5.5) |
Revision as of 13:48, 12 May 2020
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.
Dim myQuery As PDCEXT.IDBQuery = PDC.App.Database.OpenQuery(PDCEXT.pdcConnectionKind.pdcConData)
myQuery.SQL = "SELECT * FROM LK_KLANT WHERE KL_PLAATS=:ParamOne AND KL_VINK1=:ParamTwo"
myQuery.SetParamStr("ParamOne", "Amsterdam")
myQuery.SetParamBool("ParamTwo", True)
If myQuery.Execute Then
MsgBox(myQuery.GetField("KL_NAAM"))
Else
MsgBox($"Error: {PDC.App.LastError}")
End If
Availability
Available since May 2019 (from version 5.5)