Sign in to follow this  
Followers 0
Conor

Wonderware writing to SQL DB

4 posts in this topic

Hi, I am running Wonderware ver 10, sp2. I am trying to write into a DB via SQL commands from InTouch. I was wondering if anyone has any examples of the script that I need to use. I know that I need to Connect to DB run command and then disconnect from DB. Basically I want to add data from flow meters to the DB, but as these will be continually updating, I am not sure of the correct way to script this. Any help would be great. Thanks, Conor

Share this post


Link to post
Share on other sites
A. Install the SQL Database (DB). You'll need to know all about the tables. B. Set up a System DNS connection to the DB in Control Panel, Administrative Tools, Data Sources(ODBC) A. Then set up the WW SQL tags you want to read data into from the DB. C. Then set up your Bind List - (This maps your WW SQL tags to the fields in the DB. Match data types exactly.) Then in your script, set up a connection to your DB. (Code Snippet) Connection_String="DSN=dsn_myApp;APP=Microsoft Windows Operating System;WSID=(local);DATABASE=myDatabase;Trusted_Connection=Yes"; SQLResultCode=SQLConnect(SQL_ConnectionID,SQLConnectionString); IF SQLResultCode <> Then {check if connection was made} ErrorMessage = SQLErrorMessage(SQLResultCode); Endif; (To insert a record into the database) (Code Snippet) SQLResultCode = SQLInsert (SQL_Connection_ID, "Table NAme", "Bindlist Name"); To Close the DB connection (Code Snippet) SQLEnd(SQL_Connection_ID); All the SQL instructions (with help) are available in WW. Also check the WW support website for examples and technotes. www.wonderware.com

Share this post


Link to post
Share on other sites
Conor, If you have InTouch installed you could use the SQL Access Manager guide that comes as part of the InTouch installation. You will need to go to Start---->All Programs---->Wonderware---->Books. There are also demo applications available which demo most of what you want to do. If you need any further help don't hesitate to email me. Paul O'Connell Technical Resource Manager Wonderware UK & Ireland

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0