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 6782079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:41:56+00:00 2026-05-26T16:41:56+00:00

I have one database with one mirror in high-safety mode (using a witness server

  • 0

I have one database with one mirror in high-safety mode (using a witness server at the moment but planing to take him out), this database will be used to store data gathered by a c# program.

I want to know how can I check in my program the state of all the SQL instances and to cause/force a manual failover.

is there any c# API to help me with this?

info: im using sql server 2008

edit: I know I can query sys.database_mirroring but for this I need the principal database up and runing, I would like to contact each sql instance and check their status.

  • 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-26T16:41:57+00:00Added an answer on May 26, 2026 at 4:41 pm

    after playing around a bit I found this solution (i’m not if this is a proper solution, so leave comments plz)

    using Microsoft.SqlServer.Management.Smo.Wmi;
    
    ManagedComputer mc = new ManagedComputer("localhost");
    foreach (Service svc in mc.Services) {
        if (svc.Name == "MSSQL$SQLEXPRESS"){
            textSTW.Text = svc.ServiceState.ToString();
        }
        if (svc.Name == "MSSQL$TESTSERVER"){
            textST1.Text = svc.ServiceState.ToString();
        }
        if (svc.Name == "MSSQL$TESTSERVER3") {
            textST2.Text = svc.ServiceState.ToString();
        }
    }
    

    this way i’m just looking for the state of the services (Running/Stoped) and is much faster, am I missing something?

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

Sidebar

Related Questions

I have one database in mysql. But when i log into phpMyAdmin , it
I'm currently coding a product which will have only one database but will host
I am using Rails 3. In one database table, I need to have one
I have one database named TransportDB whose compatibility level is set to SQL Server
I have one database table which contains 8 columns. One of the columns is
i have one database, and it contains some columns. My requirement is that how
In StackOverflow podcast no. 19 , Joe describe Fogcreek's decision to have one database
I have two database one with relationship(no data) and another with out Relationship (with
i have one php file which process adding of record in Database fro array.
I have a list of e-mails from one database which I want to check

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.