how to correct the error when odbc Exception was unhandled?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dylan
    New Member
    • Oct 2012
    • 1

    #1

    how to correct the error when odbc Exception was unhandled?

    How to correct the error when odbc Exception was unhandled?

    Code:
    Private Function search(ByVal username As String) As Boolean
            ' Try
            Dim Sql As String
            Sql = "Select * from login where UserName='" & username & "'"
            Dim objdataAdapter As New OdbcDataAdapter(Sql, objconn)
            Dim objDataSet As New DataSet
            objdataAdapter.Fill(objDataSet, ("Login"))
            Dim objdataview As DataView
            objdataview = New DataView(objDataSet.Tables("Login"))
            If objdataview.Count > 0 Then
                Return True
            Else
                Return False
            End If
            'Catch ex As Exception
            '  MsgBox(ex.Message)
            ' End Try
        End Function
    
    End Class
    Last edited by Frinavale; Oct 26 '12, 01:05 PM. Reason: Added the question, asked in the title, to the body of the thread.
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    Why not start with giving more information about what's going wrong with the code you've provided

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      You have commented out the code that will handle the exception and display the message.

      Could you please explain what error you are seeing? There are several different odbc exceptions.

      It is good practice to only catch the exceptions that you can deal with.

      -Frinny

      Comment

      • tsanalista
        New Member
        • Nov 2012
        • 11

        #4
        Show Message Error brother....

        Comment

        Working...