Thank you!

That works beautifully.

In case anyone else is watching, here's the complete function with your changes. It's designed to have a regular SQL insert/update/delete statement passed to it (along with true or false for showing the error):

Code:
Function ExecSQLChangeTrans String sSQL Boolean bShowError Returns Integer 
    Handle  hoSQL hdbc hoConnect hoStmt
    Integer iFetchResult iCol iColumn iColumns iArraySize iRowCount iNumMessages iCount i
    String  sColumn sTemp sMessage
    
    Move "" to sMessage
    
    Move "BEGIN TRY Begin TRAN " to sTemp
    Append sTemp (Trim(sSQL)) " COMMIT TRAN End TRY Begin CATCH If(@@TRANCOUNT > 0) ROLLBACK TRAN; PRINT ERROR_MESSAGE(); End CATCH"
    Move sTemp to sSQL
    
    Get SQLConnectionId of ghoConnection "Star" to hoConnect
    Get SQLOpen of hoConnect to hoStmt        
    If (hoStmt) Begin
        Send SQLExecDirect of hoStmt sSQL
        Get  SQLStmtAttribute of hoStmt SQLSTMTATTRIB_ROWCOUNT to iRowCount
        Repeat
            Get SQLStmtAttribute of hoStmt SQLSTMTATTRIB_NUMMESSAGES to iNumMessages
            If (iNumMessages<>0) Begin
                For i from 1 to iNumMessages
                    Get SQLGetMessage of hoStmt i to sMessage
                Loop
            End
            Get SQLNextResultSet of hoStmt to i
        Until (i=0)
        Send SQLClose of hoStmt
        Send SQLDisconnect of hoConnect
        If (bShowError) Begin
            If (sMessage > "") Send UserError ("Transaction was rolled back because of the following:\n\n" + sMessage)
        End
    End 
    Else Send Stop_Box "Connection Error!  Please take a screen shot & submit a support ticket."

    Send Cursor_Ready to Cursor_Control
    Function_Return iRowCount
End_Function
The user error is after the close because we have error logging to a table & it's tough to save a record while the sql statement is open...