Getting list of database servers into combo box

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • doofy

    Getting list of database servers into combo box

    Anyone know how I can pull in a list of available database servers on my
    computer (which I will then use to populate a combo box)?

    Even just the namespace to use would be a start, though more info than
    that would be a lot more helpful.

    Filling the combo box is something I think I can figure out. Just need
    to know how to search for the servers.

    The better option is how I could access these common forms used to
    connect to databases, where all the layers are asked for in the form,
    and at the end you hit a "Test Connection" button. Are those available
    via code?
  • sloan

    #2
    Re: Getting list of database servers into combo box

    One (crappy) way is to poll this registry key:

    HKEY_LOCAL_MACH INE\SOFTWARE\Mi crosoft\MSSQLSe rver\Client\Con nectTo

    sqldmo is a key phrase





    "doofy" <nope@notme.com wrote in message
    news:47c62817$0 $36385$742ec2ed @news.sonic.net ...
    Anyone know how I can pull in a list of available database servers on my
    computer (which I will then use to populate a combo box)?
    >
    Even just the namespace to use would be a start, though more info than
    that would be a lot more helpful.
    >
    Filling the combo box is something I think I can figure out. Just need to
    know how to search for the servers.
    >
    The better option is how I could access these common forms used to connect
    to databases, where all the layers are asked for in the form, and at the
    end you hit a "Test Connection" button. Are those available via code?

    Comment

    • sloan

      #3
      Re: Getting list of database servers into combo box

      One more:



      "doofy" <nope@notme.com wrote in message
      news:47c62817$0 $36385$742ec2ed @news.sonic.net ...
      Anyone know how I can pull in a list of available database servers on my
      computer (which I will then use to populate a combo box)?
      >
      Even just the namespace to use would be a start, though more info than
      that would be a lot more helpful.
      >
      Filling the combo box is something I think I can figure out. Just need to
      know how to search for the servers.
      >
      The better option is how I could access these common forms used to connect
      to databases, where all the layers are asked for in the form, and at the
      end you hit a "Test Connection" button. Are those available via code?

      Comment

      • doofy

        #4
        Re: Getting list of database servers into combo box

        doofy wrote:
        Anyone know how I can pull in a list of available database servers on my
        computer (which I will then use to populate a combo box)?
        >
        Even just the namespace to use would be a start, though more info than
        that would be a lot more helpful.
        >
        Filling the combo box is something I think I can figure out. Just need
        to know how to search for the servers.
        >
        The better option is how I could access these common forms used to
        connect to databases, where all the layers are asked for in the form,
        and at the end you hit a "Test Connection" button. Are those available
        via code?
        Thanks for those links. At least now I have an acronym to work with,
        and some code.

        Comment

        • doofy

          #5
          Re: Getting list of database servers into combo box

          doofy wrote:
          Anyone know how I can pull in a list of available database servers on my
          computer (which I will then use to populate a combo box)?
          >
          Even just the namespace to use would be a start, though more info than
          that would be a lot more helpful.
          >
          Filling the combo box is something I think I can figure out. Just need
          to know how to search for the servers.
          >
          The better option is how I could access these common forms used to
          connect to databases, where all the layers are asked for in the form,
          and at the end you hit a "Test Connection" button. Are those available
          via code?
          By the way, that was sincere thanks. I was thinking that "at least now
          I have an acronym to work with" sounded sarcastic.

          Comment

          • sloan

            #6
            Re: Getting list of database servers into combo box

            I hear ya dude.

            "Tone" is not relayed in emails very well.

            It why its a terrible tool for things like conflict resolution or anything
            outside of just presenting factual information.

            ...

            But I appreciate the clarification.




            "doofy" <nope@notme.com wrote in message
            news:47c62ea4$0 $36374$742ec2ed @news.sonic.net ...
            doofy wrote:
            >Anyone know how I can pull in a list of available database servers on my
            >computer (which I will then use to populate a combo box)?
            >>
            >Even just the namespace to use would be a start, though more info than
            >that would be a lot more helpful.
            >>
            >Filling the combo box is something I think I can figure out. Just need
            >to know how to search for the servers.
            >>
            >The better option is how I could access these common forms used to
            >connect to databases, where all the layers are asked for in the form, and
            >at the end you hit a "Test Connection" button. Are those available via
            >code?
            >
            By the way, that was sincere thanks. I was thinking that "at least now I
            have an acronym to work with" sounded sarcastic.

            Comment

            • Nicholas Paldino [.NET/C# MVP]

              #7
              Re: Getting list of database servers into combo box

              If you don't have access to the SQL DMO objects (or the SQL Management
              objects which come with newer versions of SQL server), then you can call the
              NetServerEnum API through the P/Invoke layer, looking for the
              SV_TYPE_SQLSERV ER type.




              --
              - Nicholas Paldino [.NET/C# MVP]
              - mvp@spam.guard. caspershouse.co m

              "doofy" <nope@notme.com wrote in message
              news:47c62817$0 $36385$742ec2ed @news.sonic.net ...
              Anyone know how I can pull in a list of available database servers on my
              computer (which I will then use to populate a combo box)?
              >
              Even just the namespace to use would be a start, though more info than
              that would be a lot more helpful.
              >
              Filling the combo box is something I think I can figure out. Just need to
              know how to search for the servers.
              >
              The better option is how I could access these common forms used to connect
              to databases, where all the layers are asked for in the form, and at the
              end you hit a "Test Connection" button. Are those available via code?

              Comment

              Working...