short SetVariable(long QueryID, BSTR Name, BSTR Value)
Description
This function assigns a value to the specified variable. This value is substituted for the variable prior to running the SQL statement. If your SQL statement has one or more variables in it, call this function to set the variable values prior to calling Open() or Execute().
This function has an effect only for dynamic queries. For static queries, you should use the GetHostVariableNames(), AddHostVariable(), and SetHostVariable() functions.
Parameters
Name | Description |
---|---|
QueryID | The ID of the query as returned from InitializeQuery(). |
Name | A string that contains the name of the variable that you want to set. |
Value | A string that contains the value that you want to assign to the variable. |
Return Value
The return value will be zero if successful or non-zero if unsuccessful. If the return value is non-zero, you can call GetLastErrorString() or GetLastErrorType() to get additional error information.
Related Tasks