Allowing user selection of a datasource at run time?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am writing a database front end windows application in C#. I need to allow
a user to select a database to connect to at run time via a standard dialog
box. This is easy in Visual C++ 6.0, all you have to do is #include
atldbcli.h and then call the CDataSource class Open() method with no
parameters. This causes the 'Data Link Properties' dialog box to appear
which allows the user to select an OLEDB data provider (Jet, SQL server,
etc), and a database, etc. This data can then be retrieved from the
CDataSource object and used to construct a connection string.
Is there similar functionality provided in the .NET FCL, ie: accessible via
C#?
 
Not exactly, but you can build connection strings to connect to any OLEDB
source. With SQL Server, you can use SQL-DMO (via COM Interop) to find all of
the SQL Server instances, which is much easier.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Back
Top