Applies To:
  • CitectSCADA
  • CitectHMI

I have to make several connections at the same time to an SQL database. This is fine as I can reference them using their connection handles. However, when determining the error message with SQLErrMsg(), how can I be sure I am using the correct error message for each connection? 

You should check the error number returned from every SQLxxxxx() type functions and if this is = 307 then you should immediately call the SQLErrMsg() this will tell you the SQL specific message of the last cicode function to return the 307 error. This should be fine even if you have multiple connections to different SQL data sources as long as you call the SQLErrMsg immediately after each SQLxxxxx() function.

If however your multiple connections are handled in separate threads then there is perhaps the possibility for two 307 errors to occur before you call SQLErrMsg(). In this case you would need to use semaphores to control the situation so that only one SQLxxxx() funciton was called at a time and was then checked for a 307 error in case you need to call SQLErrMsg() before allowing the next SQLxxxxx() call to be made in another connection.