Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Capturing/supressing error message

Capturing/supressing error message

Scheduled Pinned Locked Moved Visual Basic
helpc++databasecomtesting
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    svanwass
    wrote on last edited by
    #1

    I am in the final throws of my development for an app so I have started my testing. One of my scenarios is a the removal of the SQL Native Client driver (Windows XP). After the uninstall, I attempt to run the app and am always presented with this error message, which is expected as the native client was required. The problem I have is that I did not write in a message box to display this error! I've searched through the code to find a rouge msgbox but found nothing that would present this error. Any suggestions to suppress this so I can present something more friendly? Here's how i create connection, if needed Try Using connection As New OdbcConnection(ConnectionString) Dim command As New OdbcCommand(queryString, connection) connection.Open() Dim reader As OdbcDataReader = command.ExecuteReader() While reader.Read() count = reader(0).ToString End While connection.Close() reader.Close() End Using Catch ex As Exception SQLERROR = True WriteErrorLog(ex.ToString) Exit Sub End Try

    A D 2 Replies Last reply
    0
    • S svanwass

      I am in the final throws of my development for an app so I have started my testing. One of my scenarios is a the removal of the SQL Native Client driver (Windows XP). After the uninstall, I attempt to run the app and am always presented with this error message, which is expected as the native client was required. The problem I have is that I did not write in a message box to display this error! I've searched through the code to find a rouge msgbox but found nothing that would present this error. Any suggestions to suppress this so I can present something more friendly? Here's how i create connection, if needed Try Using connection As New OdbcConnection(ConnectionString) Dim command As New OdbcCommand(queryString, connection) connection.Open() Dim reader As OdbcDataReader = command.ExecuteReader() While reader.Read() count = reader(0).ToString End While connection.Close() reader.Close() End Using Catch ex As Exception SQLERROR = True WriteErrorLog(ex.ToString) Exit Sub End Try

      A Offline
      A Offline
      AliAmjad
      wrote on last edited by
      #2

      I think this is an unhandled exception error message try to use this code to handle it:

      Dim withevents ap as AppDomain

      Private Sub ap_UnhandledException(ByVal sender As Object, ByVal e As System.UnhandledExceptionEventArgs) Handles ap.UnhandledException

      'Additional Code
      

      End Sub

      hope it helps !

      AliAmjad(MCP)

      S 1 Reply Last reply
      0
      • A AliAmjad

        I think this is an unhandled exception error message try to use this code to handle it:

        Dim withevents ap as AppDomain

        Private Sub ap_UnhandledException(ByVal sender As Object, ByVal e As System.UnhandledExceptionEventArgs) Handles ap.UnhandledException

        'Additional Code
        

        End Sub

        hope it helps !

        AliAmjad(MCP)

        S Offline
        S Offline
        svanwass
        wrote on last edited by
        #3

        Exactly what it was! Thanks for letting me know, YTMND!

        A 1 Reply Last reply
        0
        • S svanwass

          I am in the final throws of my development for an app so I have started my testing. One of my scenarios is a the removal of the SQL Native Client driver (Windows XP). After the uninstall, I attempt to run the app and am always presented with this error message, which is expected as the native client was required. The problem I have is that I did not write in a message box to display this error! I've searched through the code to find a rouge msgbox but found nothing that would present this error. Any suggestions to suppress this so I can present something more friendly? Here's how i create connection, if needed Try Using connection As New OdbcConnection(ConnectionString) Dim command As New OdbcCommand(queryString, connection) connection.Open() Dim reader As OdbcDataReader = command.ExecuteReader() While reader.Read() count = reader(0).ToString End While connection.Close() reader.Close() End Using Catch ex As Exception SQLERROR = True WriteErrorLog(ex.ToString) Exit Sub End Try

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          If you're running on SQL Server, why are you bothering with the ODBC provider?? It's slower and doesn't use any features or optimizations that are specific to using SQL Server.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          S 1 Reply Last reply
          0
          • S svanwass

            Exactly what it was! Thanks for letting me know, YTMND!

            A Offline
            A Offline
            AliAmjad
            wrote on last edited by
            #5

            ??? I wasn't letting u know that Its an unhandled exception but rather tried to give you the solution.

            AliAmjad(MCP)

            1 Reply Last reply
            0
            • D Dave Kreskowiak

              If you're running on SQL Server, why are you bothering with the ODBC provider?? It's slower and doesn't use any features or optimizations that are specific to using SQL Server.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007

              S Offline
              S Offline
              svanwass
              wrote on last edited by
              #6

              Its the only way i know how to do it programmatically...:sigh:

              D 1 Reply Last reply
              0
              • S svanwass

                Its the only way i know how to do it programmatically...:sigh:

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                It's not very different from what you already have. You're just using the OdbcXXX classes instead of the SqlXXXX set of classes.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups