troubleshooting Question

VB.Net Correct Order of Try Catch Block for Exception Handling

Avatar of lnshop
lnshop asked on
.NET Programming
8 Comments1 Solution233 ViewsLast Modified:
I am using vb.net 2003 with asp.net 1.1 and need to write some exception handing code.  Could someone please tell me the correct order of the Try/Catch/Finally/End Try Block within the below code.  I will need to use exception handing for many data connections and want to do this correctly.  Thank-you very much for your assistance.
 Sub getAdjuster()
         AdjConn = New OdbcConnection(System.Configuration.ConfigurationSettings.AppSettings("ConnectionString"))
Try
        AdjConn.Open()
        reinsclientcode = "0"
        Dim adjsql As String = "Select claims.code, claims.adjuster from claims where claims.code=""" & ClaimNo & """"
         Dim adjcmd As New OdbcCommand(adjsql, AdjConn)
        Dim adjReader As OdbcDataReader = adjcmd.ExecuteReader(CommandBehavior.CloseConnection)
Catch ex as Exception
        If adjReader.HasRows Then
            While adjReader.Read()
                ClientCode = Trim(adjReader.Item(1)).ToString()
            End While
        adjReader.Close()
        AdjConn.Close()
Finally
End Try
 getAddress()
    End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros