Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7497471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:06:56+00:00 2026-05-29T19:06:56+00:00

I have an SQL Server (2008 R2) based (C# WinForms) application that predominantly runs

  • 0

I have an SQL Server (2008 R2) based (C# WinForms) application that predominantly runs on a local machine using a local installation of SQL Server 2008 R2. One problem I have is that if the user does not have a server instance running and tries to execute some commands or perform some operations, the queries are sent off to SQL Server and it takes an age to throw an SqlException telling me the requested instance is not started.

I have read the following question and associated answers, but these solutions are far from ideal. WMI seem very much over-kill and I do not want to have to include extra .dlls in my installation package for the software if it can be avoided.

I have also come accross the SqlDataSourceEnumerator Class documented here

// Retrieve the enumerator instance and then the data.
SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;
System.Data.DataTable table = instance.GetDataSources();

which dumps the available connection into a DataTable. However, there seems to be inherent problems with returning all the available connections:

"All of the available servers may or may not be listed. The list can vary depending on 
 factors such as timeouts and network traffic. This can cause the list to be different 
 on two consecutive calls." - MSDN.

There has to be a set way of dealing with this problem. Say I have the following SqlConnection string:

Data Source=localhost;Initial Catalog=MyDB;Integrated Security=True;Connection Timeout = 0

what can I use as an efficient (this is crucial) check as to whether the selected instance (‘localhost’ [the default instance] or ‘SomeInstanceName’) is running?

Thanks for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:06:58+00:00Added an answer on May 29, 2026 at 7:06 pm

    You can change the connection timeout to be a shorter period, but essentially, the only way it knows that a server isn’t there, is from a timeout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a web based (ASP.NET MVC) application that uses SQL Server 2008 for
Here is one very interesting problem. I am using SQL Server 2008. I have
My application runs SQL Server 2008 on Windows Server 2008 using Tomcat. I am
I have an ASP.NET MVC Web Application that interacts with a SQL Server 2008
I am developing a contact manager application using SQL Server 2008 (service-based database) .
I only have SQL Server 2008 (Dev Edition) on my development machine I only
I have a Microsoft SQL Server 2008 query that returns data from three tables
I am using .NET 4.0 & C# and SQL Server 2008. I have a
I am using SQL Server 2008. I have a Non-Unique Non-clustered index on a
I have a view defined in SQL server 2008 that joins 4 tables together.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.