What would be a very fast way to determine if your connectionstring lets you connect to a database?
Normally a connection attempt keeps the user waiting a long time before notifying the attempt was futile anyway.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You haven’t mentioned what database you are connecting to, however. In SQL Server 2005, from .NET, you can specify a connection timeout in your connection string like so:
This will try to connect to the server and if it doesn’t do so in three seconds, it will throw a timeout error.