Sign in to follow this  
Followers 0
moamed

Problem with send data from Vijeo citect to SQL By triger

2 posts in this topic

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


}}

Share this post


Link to post
Share on other sites


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 values

last 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

 

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