Outrage
Member
Hi All,
I'm trying to set up a connection to move data from Citect to Excel using ODBC and SQL statements but i'm not having much luck. I'm using Citect version 7.0 and Excel 2007.
for a test I have the following cicode script and i'm running it on a simple button press:
INT
FUNCTION
Logtosql()
INT Test;
INT hSQL;
hSQL = SQLConnect("DSN=leestest");
Test = SQLExec(hSQL, "INSERT IGNORE INTO Sheet1 (test, value2) VALUES ('" + IntToStr(TAG1) + "','" + IntToStr(TAG2) + "')")
RETURN 0;
END
I've gone through several amalgamations of this with our rep with no forward progress.
The SQLConnect statement appears to link to the spreadsheet as the spreadsheet becomes read only when the script is running but no data is actually transferred to the sheet.
I've had a look at the related Knowlege Base items but there's a bit of uncertainty about the syntax for different versions of excel and the 2007 edition doesn't get a look in.
I get the following error when I execute the script:
SQL Interface - SQL Databae Error - SQLExec() (which i've read directly off the alarms summary)
I've tried contacting Citect technical but my licence is out of support and I'm not an SI (we don't do enough SCADA to make it worthwhile plus we have to use whatever our customer specifies which isn't Citect a lot of the time).
Can anyone spot where i'm going wrong? or post up some working SQL script that i can paste into my application
Best Regards,
Lee
I'm trying to set up a connection to move data from Citect to Excel using ODBC and SQL statements but i'm not having much luck. I'm using Citect version 7.0 and Excel 2007.
for a test I have the following cicode script and i'm running it on a simple button press:
INT
FUNCTION
Logtosql()
INT Test;
INT hSQL;
hSQL = SQLConnect("DSN=leestest");
Test = SQLExec(hSQL, "INSERT IGNORE INTO Sheet1 (test, value2) VALUES ('" + IntToStr(TAG1) + "','" + IntToStr(TAG2) + "')")
RETURN 0;
END
I've gone through several amalgamations of this with our rep with no forward progress.
The SQLConnect statement appears to link to the spreadsheet as the spreadsheet becomes read only when the script is running but no data is actually transferred to the sheet.
I've had a look at the related Knowlege Base items but there's a bit of uncertainty about the syntax for different versions of excel and the 2007 edition doesn't get a look in.
I get the following error when I execute the script:
SQL Interface - SQL Databae Error - SQLExec() (which i've read directly off the alarms summary)
I've tried contacting Citect technical but my licence is out of support and I'm not an SI (we don't do enough SCADA to make it worthwhile plus we have to use whatever our customer specifies which isn't Citect a lot of the time).
Can anyone spot where i'm going wrong? or post up some working SQL script that i can paste into my application
Best Regards,
Lee
Last edited: