kmkn Posted November 16, 2011 Report Posted November 16, 2011 Hi, I have two different scada system. I would like my citect scada to pull a data from MSSQL(which store data from another scada). I did some reading, and found it could be done using cicode, that is using tagwrite. the cicode will pull the data from mssql and then using tagwrite to put that data in variable tag(every 5minute), which then will be displayed in citect interface/graphic. I did my search on tagwrite, but could not find any good example to copy. Could anyone help? Thanks Quote
chelton Posted November 16, 2011 Report Posted November 16, 2011 The tagread/tagwrite cicode functions won't help you hear. These functions are only for tags that are already listed in variable tags. Have a look at the sqlconnect/sqlexec commands. What is the other scada that you want to share data with? Quote
kmkn Posted November 17, 2011 Author Report Posted November 17, 2011 (edited) I am not sure if it is really is scada as it doesn't have a plc. It is just a sensor connecting to a pc and updating the database. Sorry I am not really fluent in citect, I am just a user, I want to add it into citect using my graphic builder which request a tag, so how to add a tag that pull it data from SQL? How to use sqlconnect? Thanks Edited November 17, 2011 by kmkn Quote
kmkn Posted November 22, 2011 Author Report Posted November 22, 2011 I did study a bit on sql connect, and able to create a function using cicode, in the graphic builder i add the sql function using text properties, but when compile i get error 'incompatible type', I use the sample from help file;- FUNCTION SQLTest INT hSQL, iResult; hSQL = SQLConnect("DSN=ODBCTest;UID=YourUID_C;PWD=YourPWD"); IF hSQL <> -1 THEN iResult = SQLExec(hSQL, "SELECT * FROM qryRecipes WHERE Recipe Between '3000' And '6000'"); IF iResult = 0 THEN WHILE SQLNext(hSQL) = 0 DO TraceMsg(">" + SQLGetField(hSQL, "Recipe") + "<>" + SQLGetField(hSQL, "Flour") + "<>" + SQLGetField(hSQL, "Water") + "<>" + SQLGetField(hSQL, "Cocoa") + "<"); END SQLDisconnect(hSQL); ELSE Message("SQL Error", SQLErrMsg, 48); END ELSE Message("SQL Error", SQLErrMsg, 48); END END plz help, thanks Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.