NOP Design Home Page


Links a parameter from a stored procedure or select statement to a local SIML variable

BindParameter allows you to assign a SIML variable for use in an SQL statement or stored procedure. Binding a parameter in SIML makes that variable constant within the scope of the current function.

You must specify if the variables are Input, NullableInput, Output, or InputOutput, as well as data types and string lengths as they are defined in the database.

For ODBC database connection, use a "?" character to specify where your variable should be bound in a statement or stored procedure parameter list.

If you omit the "For [INPUTTYPE]" directive, an binding type of "INPUT" will be assumed. i.e.:
BindParameter i To 1 From dbr For Input As Integer
has the same effect as:
BindParameter i To 1 From dbr As Integer

Sample Source

If ( Connect dbDatabase to "DSN=dsn_name" as ODBC ) Then 
   iTemp := 2

   PrepareRowset dbRowset As "SELECT 'one', 2, 3.0 WHERE 2 = ?" From dbDatabase
   BindParameter iTemp To 1 From dbRowset For Input As Integer
   BindColumn MyOutput1 To 1 From dbRowset As String 10
   BindColumn MyOutput2 To 2 From dbRowset As Integer
   BindColumn MyOutput3 To 3 From dbRowset As Number
   iReturn := GetRowset dbRowset
   If iReturn < 0 Then
      Say GetLastError dbRowset
   While iReturn > 0
      Say MyOutput1 + "<br>"
      Say MyOutput2 + "<br>"
      Say MyOutput3 + "<br>"
      iReturn := SelectRow Next From dbRowset

   Disconnect MyDatabase

Related Function(s):
   BindColumn; GetRowset;

Minimum version: 3.0