Friends,
Following is a method in one of my VB6.0 class that I intend to deploy as COM+ application. I have a phobia handling errors... I guess. Please comment on the simple error handling I have used. And any suggestions/advise is highly appreciated.
Thanks in advance!
"RaiseError" is a sub that simply does
VB Code:
err.raise eNo, eSrc, eDesc
VB Code:
Public Function GetCustomClients(ByVal bRegClient As Boolean) As ADODB.Recordset '================================================== ' Parameters In: Boolean flag; True for regular clients ' Returns : Recordset containing - Client-Id, Client-Name ' and Description ' Description : Used to build the User-Interface (list-box) '================================================== On Error GoTo errHandler Dim cClient As New ADODB.Command Dim pFlg As ADODB.Parameter eNo = 0 'declared form-level eDesc = vbNullString 'form-level eSrc = "GetCustomClients" 'form-level cClient.ActiveConnection = ConnStr cClient.CommandType = adCmdStoredProc cClient.CommandText = "qryCustomClients" Set pFlg = cClient.CreateParameter("bFlg", adBoolean, adParamInput, , bRegClient) cClient.Parameters.Append pFlg Set GetCustomClients = cClient.Execute() errExit: Exit Function errHandler: If Err.Number > 0 Then eNo = Err.Number eDesc = Err.Description Err.Clear On Error GoTo 0 Call RaiseError End If End Function




Reply With Quote