473,320 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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
"GetServerList" and "GetDatabaseList" type of methods if not an entire
control with all of the input fields?

Thanks!
Bill Faulk
Nov 17 '05 #1
6 3760
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

ListAvailableSQLServers

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

http://msdn.microsoft.com/library/de...csmpsqldmo.asp

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

http://msdn.microsoft.com/library/de...wseconnect.asp

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_cmdshell '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

Nov 17 '05 #2
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

ListAvailableSQLServers

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

http://msdn.microsoft.com/library/de...csmpsqldmo.asp

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

http://msdn.microsoft.com/library/de...wseconnect.asp

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_cmdshell '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

Nov 17 '05 #3
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#:

http://www.csharphelp.com/archives2/archive342.html

Bill Faulk

"Wysiwyg" <wy*****@xmissionNSPAM.com> wrote in message
news:Ol**************@TK2MSFTNGP15.phx.gbl...
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.
.... Is there already a library with this functionality? Something with a
"GetServerList" and "GetDatabaseList" type of methods if not an entire
control with all of the input fields?

Thanks!
Bill Faulk

Nov 17 '05 #4
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#:

http://www.csharphelp.com/archives2/archive342.html

Bill Faulk

"Wysiwyg" <wy*****@xmissionNSPAM.com> wrote in message
news:Ol**************@TK2MSFTNGP15.phx.gbl...
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.
.... Is there already a library with this functionality? Something with a
"GetServerList" and "GetDatabaseList" type of methods if not an entire
control with all of the input fields?

Thanks!
Bill Faulk

Nov 17 '05 #5
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.
<bi********@netscape.net> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
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

ListAvailableSQLServers

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

http://msdn.microsoft.com/library/de...csmpsqldmo.asp
There is also something called SQLBrowseConnect which I know little
about, but here's a link:

http://msdn.microsoft.com/library/de...wseconnect.asp
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_cmdshell '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

Nov 17 '05 #6
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.
<bi********@netscape.net> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
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

ListAvailableSQLServers

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

http://msdn.microsoft.com/library/de...csmpsqldmo.asp
There is also something called SQLBrowseConnect which I know little
about, but here's a link:

http://msdn.microsoft.com/library/de...wseconnect.asp
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_cmdshell '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

Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Frodo | last post by:
I have a problem establishing a link between Visual Studio.NET 2003 and SQL Server 2000. Both are installed on a Windows Server 2003, standard version. Visual Studio.NET Issues...
2
by: Mark Fisher | last post by:
From Enterprise Manager on my PC, how do I connect to a remote server over the internet - I have the IP address, User Name and Password. Thanks
0
by: Wysiwyg | last post by:
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...
13
by: Edward Mitchell | last post by:
I have a problem that involves the error I receive when attempting to complete the asp.net web application example (Walkthrough: Creating a Web Application Using a Third-Party Business Object). ...
5
by: pberna | last post by:
Dear all, I built a Web Form application to start and stop a Windows Service remotely. I successful tested the application on Windows 2000 server + IIS. I must include the ASPNET user to the...
5
by: Microsoft | last post by:
Hi, I have Visual Basic .net 2003 (Standard Edition) & SQL Server 2000 Developer Edition. When trying to create a connection in the server explorer from the .net IDE I get a number of problems;...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
3
by: Arpan | last post by:
I recently installed SQL Server 2005 (Management Studio Express) along with SQL Server 2005 Express (Configuration Manager) in my Win2K Pro m/c & use IIS 5.0 to run ASPX projects. I could add my...
5
by: marshmallowww | last post by:
I have an Access 2000 mde application which uses ADO and pass through queries to communicate with SQL Server 7, 2000 or 2005. Some of my customers, especially those with SQL Server 2005, have had...
3
by: shobhitguptait | last post by:
How to Run C#.NET Windows App on N/W with centralized DB using SQL SERVER 2000 Hello All...i m really grate full to c such a website where developers try to help people like us who face problems...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.