I
Igor G
I have written the code that allows to work with a password protected
Microsoft Access database as well as with regular (not password protected)
Access DB in VB. Net. I use OleDb objects. I need to identify whether a
current database is password protected, or not. For this purpose, I create a
regular connection string with no password set, and try to open the
connection. This piece of code is embedded into Try..Catch.. structure. If a
database is password protected, an OleDb exception is raised, with the
message "Not a valid password". To determine what is the reason of failure to
open a connection, I test the message property of the exception. If it
contains the string "Not a valid password", then I can conclude that the
database is password protected.
This code worked fine until we shipped our software to Netherland. I have
found that the message is now "Geen geldig watchwoord", and my code stopped
working.
The question 1: is there a way to identify the particular exception by an
universal attribute (like Error number) without relying onto its message
(which looks different in localized versions of OS)?
The question 2: is there an alternative way to find whether a Microsoft
Access database is password protected?
Thanks
Igor
Microsoft Access database as well as with regular (not password protected)
Access DB in VB. Net. I use OleDb objects. I need to identify whether a
current database is password protected, or not. For this purpose, I create a
regular connection string with no password set, and try to open the
connection. This piece of code is embedded into Try..Catch.. structure. If a
database is password protected, an OleDb exception is raised, with the
message "Not a valid password". To determine what is the reason of failure to
open a connection, I test the message property of the exception. If it
contains the string "Not a valid password", then I can conclude that the
database is password protected.
This code worked fine until we shipped our software to Netherland. I have
found that the message is now "Geen geldig watchwoord", and my code stopped
working.
The question 1: is there a way to identify the particular exception by an
universal attribute (like Error number) without relying onto its message
(which looks different in localized versions of OS)?
The question 2: is there an alternative way to find whether a Microsoft
Access database is password protected?
Thanks
Igor