For what it's worth, I'm not sure checking the authentication mode prior to attempting a connection is going to help.
If the authentication mode is Windows Auth, you won't know until you try to connect whether the identity of the current user has login rights.
If the authentication mode is Mixed Auth, there's no guarantee that the account & password you specify is going to work either - so I don't think you have an alternative but to use trial and error.
RobS
2009-04-03 01:12:40