NOP Design Home Page
Documentation
TOC/Index
Search
Downloads



BindColumn

Links a column from a database select statement to a SIML variable.

You may specify data types and string lengths as you wish to have them in your SIML program. These types do not need to match what you have in the database. SIML will automatically convert most data types for you.

You must not bind a string of a shorter length than may be returned from the database, or you will receive a database error from GetRowset.

Sample Source

# Connect to the database, compile a sql statement 
# bind three result columns, execute the statement
# and output the rows returned

If ( Connect dbDatabase to "DSN=dsn_name" as ODBC ) Then 
   PrepareRowset dbRowset As "SELECT 'one', 2, 3.0" From dbDatabase
   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
   EndIf
   While iReturn > 0
      Say MyOutput1 + "<br>"
      Say MyOutput2 + "<br>"
      Say MyOutput3 + "<br>"
      iReturn := SelectRow Next From dbRowset
   Loop

   Disconnect MyDatabase
Endif

Related Function(s):
   BindParameter; GetColumn; GetColumncount; GetColumnname; GetColumnnullability; GetColumnprecision; GetColumnsize; GetColumntype; GetRowset; IsNull;

Minimum version: 3.0