Jump to content

Recommended Posts

Posted
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
Posted
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?
Posted (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 by kmkn
Posted
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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...