Citect cicode sql

K

Thread Starter

kmkn

Hi,

I run this code in cicode function -<pre>
FUNCTION SQLTest2
INT hSQL, iResult;
STRING sName;
hSQL = SQLConnect("DSN=citectmssqlh;DB=Histy;");
IF hSQL <> -1 THEN
iResult = SQLExec(hSQL, "select top 1 CONVERT(nvarchar(4000),SampleValue) as SampleValue from dbo.AllSamples where TagID='443' order by SampleDateTime desc");
IF iResult = 0 THEN
sName = SQLGetField( hSQL, "SampleValue" );
RETURN sName;
END
SQLDisconnect(hSQL);
ELSE
Message("SQL Error", SQLErrMsg, 48);
END

Message("SQL Error", SQLErrMsg, 48);
END </pre>
When i add it in graphic builder under text properties and compile it i get 'incompatible types' error

Please help
Thanks
 
> I run this code in cicode function
> -<pre>
> FUNCTION SQLTest2
> INT hSQL, iResult;
> STRING sName;
> hSQL =</pre>
---- snip ----

just need to add a STRING before FUNCTION SQLTest2
eg. STRING FUNCTION SQLTest2
 
Top