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. Visual Basic
  4. View Network SQL Servers

View Network SQL Servers

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasesysadminhelp
9 Posts 6 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.
  • Y Offline
    Y Offline
    Yosh_
    wrote on last edited by
    #1

    Hi guys, i just wrote a vb.net program. i need to be able to view all sql servers on the office network in order to generate a dynamic connection string. pls help.

    He who goes for revenge must first dig two graves.

    D T 2 Replies Last reply
    0
    • Y Yosh_

      Hi guys, i just wrote a vb.net program. i need to be able to view all sql servers on the office network in order to generate a dynamic connection string. pls help.

      He who goes for revenge must first dig two graves.

      D Offline
      D Offline
      DaveAuld
      wrote on last edited by
      #2

      I don't think that a well configured SQL server is just going to sit on the network and broadcast out saying 'Hi, I'm an SQL Server, Why don't you try and hack me' You will need to get a list of the SQL servers from the relevant server admins, as well as which ports they accept connections on.

      Dave Don't forget to rate messages! Find Me On: Web|Facebook|Twitter|LinkedIn Waving? dave.m.auld[at]googlewave.com

      Y 1 Reply Last reply
      0
      • D DaveAuld

        I don't think that a well configured SQL server is just going to sit on the network and broadcast out saying 'Hi, I'm an SQL Server, Why don't you try and hack me' You will need to get a list of the SQL servers from the relevant server admins, as well as which ports they accept connections on.

        Dave Don't forget to rate messages! Find Me On: Web|Facebook|Twitter|LinkedIn Waving? dave.m.auld[at]googlewave.com

        Y Offline
        Y Offline
        Yosh_
        wrote on last edited by
        #3

        ok. thanx. now i understand. But pls how do i get this done. Plus, what about if i'm trying 2 connect my windows application to an online server (like on my website, www.mysite.com)?

        He who goes for revenge must first dig two graves.

        D D 2 Replies Last reply
        0
        • Y Yosh_

          ok. thanx. now i understand. But pls how do i get this done. Plus, what about if i'm trying 2 connect my windows application to an online server (like on my website, www.mysite.com)?

          He who goes for revenge must first dig two graves.

          D Offline
          D Offline
          DaveAuld
          wrote on last edited by
          #4

          You simply set the server and port in the connection string; See this site for a list of all the common ones; http://www.connectionstrings.com/[^]

          Dave Don't forget to rate messages! Find Me On: Web|Facebook|Twitter|LinkedIn Waving? dave.m.auld[at]googlewave.com

          1 Reply Last reply
          0
          • Y Yosh_

            ok. thanx. now i understand. But pls how do i get this done. Plus, what about if i'm trying 2 connect my windows application to an online server (like on my website, www.mysite.com)?

            He who goes for revenge must first dig two graves.

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            Creamboy wrote:

            what about if i'm trying 2 connect my windows application to an online server (like on my website, www.mysite.com)?

            If you're talking about connecting to an SQL Server over the internet, forget it. Noone in their right mind would EVER expose an SQL server directly to the Internet. You would notmally expose SQL functionality at the application level through a Web Service and have your app use the web service to do the work.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008
            But no longer in 2009...

            W 1 Reply Last reply
            0
            • Y Yosh_

              Hi guys, i just wrote a vb.net program. i need to be able to view all sql servers on the office network in order to generate a dynamic connection string. pls help.

              He who goes for revenge must first dig two graves.

              T Offline
              T Offline
              tosch
              wrote on last edited by
              #6

              Try Sql.SqlDataSourceEnumerator.Instance.GetDataSources This will give you a datatable with a row for each SQL-Server found in the network. Please read the helpfile for further info.

              Tosch

              L 1 Reply Last reply
              0
              • D Dave Kreskowiak

                Creamboy wrote:

                what about if i'm trying 2 connect my windows application to an online server (like on my website, www.mysite.com)?

                If you're talking about connecting to an SQL Server over the internet, forget it. Noone in their right mind would EVER expose an SQL server directly to the Internet. You would notmally expose SQL functionality at the application level through a Web Service and have your app use the web service to do the work.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008
                But no longer in 2009...

                W Offline
                W Offline
                William Winner
                wrote on last edited by
                #7

                Get a little lost in the messages? His first question was about finding sql servers on his network...which there are ways to do that (see Tosch's response below for one). He was told by someone that apparently doesn't know a whole lot about it that it was a ridiculous idea. So, he instead asked how he would connect to a server he knew about. If you're trying to connect to an online server you just need to know what kind of server you're dealing with. If you know that, check out http://www.connectionstrings.com/[^] for examples.

                D 1 Reply Last reply
                0
                • T tosch

                  Try Sql.SqlDataSourceEnumerator.Instance.GetDataSources This will give you a datatable with a row for each SQL-Server found in the network. Please read the helpfile for further info.

                  Tosch

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #8

                  Strange. I used to use SmoApplication.EnumAvailableSqlServers()[^], but I like your method better. :)

                  Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                  I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
                  All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.


                  1 Reply Last reply
                  0
                  • W William Winner

                    Get a little lost in the messages? His first question was about finding sql servers on his network...which there are ways to do that (see Tosch's response below for one). He was told by someone that apparently doesn't know a whole lot about it that it was a ridiculous idea. So, he instead asked how he would connect to a server he knew about. If you're trying to connect to an online server you just need to know what kind of server you're dealing with. If you know that, check out http://www.connectionstrings.com/[^] for examples.

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #9

                    No, not lost. Just commenting on what appeared to be a request to connect to an SQL Server directly connected to the 'Net. what about if i'm trying 2 connect my windows application to an online server (like on my website, www.mysite.com)?

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007, 2008
                    But no longer in 2009...

                    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