moamed Posted June 12, 2016 Report Posted June 12, 2016 Hi Guys I tray to write Cicode that send data from Vijeo citect to SQL Automatic or i mean By triger this is the code but it didn't work Please any one can help me {{ FUNCTION excel() INT hSQL; STRING sSQL; IF report_Triger=1 THEN hSQL = SQLConnect("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ias;Data Source=ABDELWAHED-PC\WINCC"); SQLExec(hSQL, sSQL); sSQL = "INSERT INTO dbo.test1 (level1,level2, level3,level4,Final_level) VALUES("level1","level2","level3","level4","level")"; END END }} Quote
moamed Posted June 13, 2016 Author Report Posted June 13, 2016 it work this the final code {{FUNCTION Report_time()INT hSQL;INT result_Report;STRING sssdate;STRING ssstime;STRING ssslevel11;STRING ssslevel21;STRING ssslevel31;STRING ssslevel41;STRING ssslevel;//sssdate = Date();sssdate =TimeToStr(TimeCurrent(),1);ssstime =TimeToStr(TimeCurrent(),3);ssslevel11=level1;ssslevel21=level2;ssslevel31=level3;ssslevel41=level4;ssslevel =level;hSQL = SQLConnect("DSN=Abdelwahed");result_Report = SQLExec(hSQL, "INSERT INTO level_time_2 (time,date,level1, level2,level3, level4, Final_level)VALUES ('" + sssdate + "','" + ssstime + "','" + ssslevel11 + "', '" + ssslevel21 + "','" + ssslevel31 + "','" + ssslevel41 + "','" + ssslevel + "')");SQLDisconnect(hSQL);END}}to move new line to table i create push button and write in it's input command function name -> Report_time()every time i press the push button new line create in table with new valueslast thing i want to do instead of this push button i need to use trigger certain variable when it's value change from 0 to 1 new line create in table with new values 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.