Capturing/supressing error message
-
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
-
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
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)
-
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)
-
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
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 -
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 -
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