IAG - FAQ - How To Use A TCL Script To Read and Write Data From ODBC Databas...
IAG - FAQ - How To Use A TCL Script To Read and Write Data From ODBC Databas...
Problem Description:
How to use a TCL script to read and write data from ODBC Database for WebAccess ?
Page 1
3 Calculation the amount of data
TCL script:
SQLPREPARE "DECLARE C1 CURSOR FOR"
SQLPREPARE "SELECT count(*) FROM testing"
SQLEXECUTE
SQLDIRECT "OPEN C1"
SQLDIRECT "FETCH NEXT C1 INTO Counter"
Explanation:
Use “CURSOR” to obtain the amount of data
“count(*)” is SQL command to obtain the amount of data
“testing” is name of data table
“C1” is cursor name
“Counter” is constant Tag in WebAccess
Page 2
4 Read data to the ODBC database
TCL script :
SQLPREPARE "DECLARE C1 CURSOR FOR"
SQLPREPARE "SELECT myValue FROM testing"
SQLEXECUTE
Page 3
5 Close ODBC database connection :
TCL script :
SQLDIRECT "DISCONNECT SESSION 1"
Explanation:
SESSION 1 : The number of ODBC connection
Reference:
1. 12.10.11 Read database into an Array for Display with SQL
2. 12.10.12 Write data into an ODBC database
Page 4