Sql Server connection dialog control?

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

    Sql Server connection dialog control?

    I'm writing an application in C# with Visual Studio 2003.

    I want to put a sql server connection dialog on a form used to configure an
    application. This is for setting up the connection and saving the
    user,password, server, and database with a "test connection" button. This is
    for a configuration form as opposed to having the connection dialog
    automatically pop-up every time the user starts the application and tries to
    connect to a datasource.

    Obviously, I can just have the user enter the user id, password, server, and
    database but I'm looking to include the drop down lists of available servers
    and databases like what is usually seen when creating database connections
    without having to write the whole thing myself. I want a control to do this
    ahead of actually running the application; it's just for saving the
    connection settings. I am NOT looking to have the standard dialog show up
    when the actual connection to the database is needed. I want to embed the
    input fields into a form and not have a dialog pop up.

    Is there already a library with this functionality? Something with a
    "GetServerL ist" and "GetDatabaseLis t" type of methods if not an entire
    control with all of the input fields?

    Thanks!
    Bill Faulk


  • billmiami2@netscape.net

    #2
    Re: Sql Server connection dialog control?

    I'm not sure if there is a set of .NET classes, but if you're willing
    to use com interop, you can use the SQLDMO library. A method exists
    called

    ListAvailableSQ LServers

    Which will allow you to list the SQL Servers on the network. SQLDMO
    also provides you with the ability to get to the details of any SQL
    object so creating lists of databases, tables, columns and their
    attributes is very simple. You can get samples at



    There is also something called SQLBrowseConnec t which I know little
    about, but here's a link:



    If you don't want to use SQLDMO, you can create a couple of simple
    stored procedures. To list available SQL Servers, you can create a
    stored procedure based on the extended procedure

    exec master..xp_cmds hell 'ISQL -L'

    Which will give you a list that likely needs a bit of formatting. From
    there, you can create a listing of the databases on the server by
    writing a procedure based on the sysdatabases table or executing
    sp_helpdb. I like this approach because it's nice and simple.

    Bill E.
    Hollywood, FL

    Comment

    • billmiami2@netscape.net

      #3
      Re: Sql Server connection dialog control?

      I'm not sure if there is a set of .NET classes, but if you're willing
      to use com interop, you can use the SQLDMO library. A method exists
      called

      ListAvailableSQ LServers

      Which will allow you to list the SQL Servers on the network. SQLDMO
      also provides you with the ability to get to the details of any SQL
      object so creating lists of databases, tables, columns and their
      attributes is very simple. You can get samples at



      There is also something called SQLBrowseConnec t which I know little
      about, but here's a link:



      If you don't want to use SQLDMO, you can create a couple of simple
      stored procedures. To list available SQL Servers, you can create a
      stored procedure based on the extended procedure

      exec master..xp_cmds hell 'ISQL -L'

      Which will give you a list that likely needs a bit of formatting. From
      there, you can create a listing of the databases on the server by
      writing a procedure based on the sysdatabases table or executing
      sp_helpdb. I like this approach because it's nice and simple.

      Bill E.
      Hollywood, FL

      Comment

      • Wysiwyg

        #4
        Re: Sql Server connection dialog control?

        Answering my own question:

        SQL-DMO has the methods needed to get the server and database list. I made
        my own user control to do what I wanted

        Here's a good article that demonstrates this for c#:



        Bill Faulk

        "Wysiwyg" <wysiwyg@xmissi onNSPAM.com> wrote in message
        news:OlUxPoLXFH A.3184@TK2MSFTN GP15.phx.gbl...[color=blue]
        > I'm writing an application in C# with Visual Studio 2003.
        >
        > I want to put a sql server connection dialog on a form used to configure[/color]
        an[color=blue]
        > application. This is for setting up the connection and saving the
        > user,password, server, and database with a "test connection" button. This[/color]
        is[color=blue]
        > for a configuration form as opposed to having the connection dialog
        > automatically pop-up every time the user starts the application and tries[/color]
        to[color=blue]
        > connect to a datasource.
        >[/color]
        ....[color=blue]
        > Is there already a library with this functionality? Something with a
        > "GetServerL ist" and "GetDatabaseLis t" type of methods if not an entire
        > control with all of the input fields?
        >
        > Thanks!
        > Bill Faulk
        >
        >[/color]


        Comment

        • Wysiwyg

          #5
          Re: Sql Server connection dialog control?

          Answering my own question:

          SQL-DMO has the methods needed to get the server and database list. I made
          my own user control to do what I wanted

          Here's a good article that demonstrates this for c#:



          Bill Faulk

          "Wysiwyg" <wysiwyg@xmissi onNSPAM.com> wrote in message
          news:OlUxPoLXFH A.3184@TK2MSFTN GP15.phx.gbl...[color=blue]
          > I'm writing an application in C# with Visual Studio 2003.
          >
          > I want to put a sql server connection dialog on a form used to configure[/color]
          an[color=blue]
          > application. This is for setting up the connection and saving the
          > user,password, server, and database with a "test connection" button. This[/color]
          is[color=blue]
          > for a configuration form as opposed to having the connection dialog
          > automatically pop-up every time the user starts the application and tries[/color]
          to[color=blue]
          > connect to a datasource.
          >[/color]
          ....[color=blue]
          > Is there already a library with this functionality? Something with a
          > "GetServerL ist" and "GetDatabaseLis t" type of methods if not an entire
          > control with all of the input fields?
          >
          > Thanks!
          > Bill Faulk
          >
          >[/color]


          Comment

          • Wysiwyg

            #6
            Re: Sql Server connection dialog control?

            Thanks Bill,

            SQL DMO is just what I was looking for. The DMO Methods for listing servers
            and enumerating the databases were what I needed to write my user control.


            <billmiami2@net scape.net> wrote in message
            news:1116545275 .786930.140200@ g43g2000cwa.goo glegroups.com.. .[color=blue]
            > I'm not sure if there is a set of .NET classes, but if you're willing
            > to use com interop, you can use the SQLDMO library. A method exists
            > called
            >
            > ListAvailableSQ LServers
            >
            > Which will allow you to list the SQL Servers on the network. SQLDMO
            > also provides you with the ability to get to the details of any SQL
            > object so creating lists of databases, tables, columns and their
            > attributes is very simple. You can get samples at
            >
            >[/color]
            http://msdn.microsoft.com/library/de...csmpsqldmo.asp[color=blue]
            >
            > There is also something called SQLBrowseConnec t which I know little
            > about, but here's a link:
            >
            >[/color]
            http://msdn.microsoft.com/library/de...wseconnect.asp[color=blue]
            >
            > If you don't want to use SQLDMO, you can create a couple of simple
            > stored procedures. To list available SQL Servers, you can create a
            > stored procedure based on the extended procedure
            >
            > exec master..xp_cmds hell 'ISQL -L'
            >
            > Which will give you a list that likely needs a bit of formatting. From
            > there, you can create a listing of the databases on the server by
            > writing a procedure based on the sysdatabases table or executing
            > sp_helpdb. I like this approach because it's nice and simple.
            >
            > Bill E.
            > Hollywood, FL
            >[/color]


            Comment

            • Wysiwyg

              #7
              Re: Sql Server connection dialog control?

              Thanks Bill,

              SQL DMO is just what I was looking for. The DMO Methods for listing servers
              and enumerating the databases were what I needed to write my user control.


              <billmiami2@net scape.net> wrote in message
              news:1116545275 .786930.140200@ g43g2000cwa.goo glegroups.com.. .[color=blue]
              > I'm not sure if there is a set of .NET classes, but if you're willing
              > to use com interop, you can use the SQLDMO library. A method exists
              > called
              >
              > ListAvailableSQ LServers
              >
              > Which will allow you to list the SQL Servers on the network. SQLDMO
              > also provides you with the ability to get to the details of any SQL
              > object so creating lists of databases, tables, columns and their
              > attributes is very simple. You can get samples at
              >
              >[/color]
              http://msdn.microsoft.com/library/de...csmpsqldmo.asp[color=blue]
              >
              > There is also something called SQLBrowseConnec t which I know little
              > about, but here's a link:
              >
              >[/color]
              http://msdn.microsoft.com/library/de...wseconnect.asp[color=blue]
              >
              > If you don't want to use SQLDMO, you can create a couple of simple
              > stored procedures. To list available SQL Servers, you can create a
              > stored procedure based on the extended procedure
              >
              > exec master..xp_cmds hell 'ISQL -L'
              >
              > Which will give you a list that likely needs a bit of formatting. From
              > there, you can create a listing of the databases on the server by
              > writing a procedure based on the sysdatabases table or executing
              > sp_helpdb. I like this approach because it's nice and simple.
              >
              > Bill E.
              > Hollywood, FL
              >[/color]


              Comment

              Working...