Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to enumarate SQL Server local instances in C#?

how to enumarate SQL Server local instances in C#?

Scheduled Pinned Locked Moved C#
tutorialcsharpdatabasesql-servervisual-studio
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bouli
    wrote on last edited by
    #1

    Hello gurus, I'd like to know how I can enumerate the SQL Server instances on the local machine? How can do this in C#? For example, if I have installed the default instance, an the instance named "TOTO" on my system, I wish to see the two names in my enumaration (local and TOTO). Best regards. Fred. Note: the sample in VS 7.1 that uses ODBC does not work with SQL Server 2005 and VS2005.

    There is no spoon.

    B 1 Reply Last reply
    0
    • B bouli

      Hello gurus, I'd like to know how I can enumerate the SQL Server instances on the local machine? How can do this in C#? For example, if I have installed the default instance, an the instance named "TOTO" on my system, I wish to see the two names in my enumaration (local and TOTO). Best regards. Fred. Note: the sample in VS 7.1 that uses ODBC does not work with SQL Server 2005 and VS2005.

      There is no spoon.

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      Check this[^]

      B 1 Reply Last reply
      0
      • B Blue_Boy

        Check this[^]

        B Offline
        B Offline
        bouli
        wrote on last edited by
        #3

        I was talking about this sample. it does not work on VS 2005 & SQL Server 2005...

        There is no spoon.

        B 1 Reply Last reply
        0
        • B bouli

          I was talking about this sample. it does not work on VS 2005 & SQL Server 2005...

          There is no spoon.

          B Offline
          B Offline
          Blue_Boy
          wrote on last edited by
          #4

          Did you try to convert project for VS2005?

          B 1 Reply Last reply
          0
          • B Blue_Boy

            Did you try to convert project for VS2005?

            B Offline
            B Offline
            bouli
            wrote on last edited by
            #5

            yes, I have converted it. I have started the browser service and I could run it. But it enumerates the SQL Servers on the local network, not the instances on the local machine. For example, if I have two instances (default and TOTO), I should get the MSSQLSERVER service that runs for the default instance, and MSSQLSERVER$TOTO service that runs for the TOTO instance... I wish to retrieve this information. Best regards.

            There is no spoon.

            B 1 Reply Last reply
            0
            • B bouli

              yes, I have converted it. I have started the browser service and I could run it. But it enumerates the SQL Servers on the local network, not the instances on the local machine. For example, if I have two instances (default and TOTO), I should get the MSSQLSERVER service that runs for the default instance, and MSSQLSERVER$TOTO service that runs for the TOTO instance... I wish to retrieve this information. Best regards.

              There is no spoon.

              B Offline
              B Offline
              Blue_Boy
              wrote on last edited by
              #6

              Check this[^]

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups