A Generic Odbc Error-Trapping Routine

This generic subroutine is able to trap errors for all the ODBC Objects in
LotusScript.

Example:-

res%=resultSet.UpdateRow
If res% = False Then
Call GetODBCErrorInfo (con, qry, resultSet, "Update (Click Event)", "Update")
Call con.Disconnect
End If

Sub GetODBCErrorInfo (con As ODBCConnection, qry As ODBCQuery, _
resultSet As ODBCResultSet, strRoutineName As String, strAction As String)
%REM
This subroutine will capture the error in the ODBC objects and displays
the error number code and the extended message format.
--> (1) con - ODBCConnection object
--> (2) qry - ODBCQuery
--> (3) resultSet - ODBCResultSet
--> (4) strRoutineName - Name of your routine where it is called
--> (5) strAction - Action name associated with your script (Optional)
%END REM

objectError$ = con.GetExtendedErrorMessage(con.GetError)
message$ = "Error in OBDC Connetion Object : " + objectError$

If objectError$ = "" Then
objectError$ = qry.GetExtendedErrorMessage(qry.GetError)
message$ = "Error in ODBC Query Object : " + objectError$
End If

If objectError$ = "" Then
objectError$ = resultSet.GetExtendedErrorMessage(resultSet.GetError)
message$ = "Error in ODBC ResultSet Object : " +
objectError$
End If

If strAction <> "" Then
msg$ = "Error in subroutine : " + strRoutineName +"." + Chr$(10) + _
"Action : " + strAction + Chr$(10) + _
"Error : " + message$ + "."
Else
msg$ = "!!!Error in subroutine : " + strRoutineName +"." + Chr$(10) +
_
"Error : " + message$ + "."
End If
Msgbox msg$, 48, "ODBC Error Handler"

End Sub
This was last published in November 2000

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchExchange

SearchContentManagement

Close