Cicode Programming Reference > Cicode Function Categories > SQL Functions Introduction > SQLEnd


Ends the execution of an SQL query (from the latest SQLExec() call). If you have called the SQLExec() function from within a database connection, you should call SQLEnd() before you disconnect from that database. When the SQLEnd() function ends the execution of the current SQL query, it frees the memory that was allocated for that query.

Only one query can be active at a time, so you do not need to end one query before you execute another query each time you call SQLExec(), the previous query (through a previous SQLExec() call) is automatically ended. Similarly, CitectSCADA automatically ends the latest query when it disconnects the database, even if you have not called SQLEnd(). However, the SQLEnd() function aids efficiency SQLEnd() releases the memory that was allocated when the latest query was executed.




The handle to the SQL connection, returned from the SQLConnect() function. The SQL connection handle identifies the table where details of the associated SQL connection are stored.

Return Value

0 (zero) if successful, otherwise an error number is returned. (For details of the 307 error code, call the SQLErrMsg() function).

Related Functions

SQLBeginTran, SQLCommit, SQLConnect, SQLErrMsg, SQLExec, SQLFieldInfo, SQLGetField, SQLInfo, SQLNext, SQLNoFields, SQLNumChange, SQLRollBack, SQLTraceOff, SQLTraceOn


See SQLConnect

See Also

SQL Functions