Wednesday, January 26, 2011

Step by Step Insert Data to Microsoft Access (ODBC)

How to write data to MS Access using Wonderware InTouch's script:
1. Create a database, tables in MS Access.
2. Create a DSN for the database that we have made in step 1. For example, the name DSN = MyDSN
3. Use the script SQLConnect to connect to an Access database.
Error DIM AS INTEGER; error = SQLConnect (ConnectionID, "DSN =
MyDSN"); error_con = SQLErrorMsg (error);
4. Make BindList on InTouch. Log into the SQL Access Manager, create new BindList. This BindList  function is for mapping the tagname to the column on the Database.
Keep in mind, the column must use [], suppose the name of the column is level, in bindlist, type [Level]
5. Create a script to insert data into the database:
Error DIM AS INTEGER;
error = SQLInsert (ConnectionID, "Test", "Level");
error_ins = SQLErrorMsg (error);

No comments:

Post a Comment