473,387 Members | 1,548 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,387 software developers and data experts.

Connection String Dialog

Hi,

How can I display to the user the "Connection String Dialog" (The Dialog to build connection string) in my application ?


Thanks,

Steph.
Nov 16 '05 #1
3 11029
You can do it with COM Interop. Just figure CLSID (Guid attribute) of this
dialogbox (I thin kthe internal name is DataLinks, but maybe I'm wrong).
Then just use it.
It's bad way, better rewrite it in managed code youself...

--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"Steph." <st***@nomail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,

How can I display to the user the "Connection String Dialog" (The Dialog to
build connection string) in my application ?
Thanks,

Steph.
Nov 16 '05 #2
You can reference the OLEDB library (Microsoft OLE DB Service Component) in
your project to get easy access to it. Note thought that it will give you
OLEDB connection strings (System.Data.OleDb)- and not System.Data.SqlClient
connection strings (although they are similar - but not quite).
Arild

"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:u$**************@TK2MSFTNGP12.phx.gbl...
You can do it with COM Interop. Just figure CLSID (Guid attribute) of this
dialogbox (I thin kthe internal name is DataLinks, but maybe I'm wrong).
Then just use it.
It's bad way, better rewrite it in managed code youself...

--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "
"Steph." <st***@nomail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,

How can I display to the user the "Connection String Dialog" (The Dialog to build connection string) in my application ?
Thanks,

Steph.

Nov 16 '05 #3
Thanks but I found exactly what I wanted... I let the solution here for others :

Here is the link to microsoft website : http://support.microsoft.com/default...b;EN-US;310083
For Component Object Model (COM) interoperability, you must declare the ADO Connection object as ADODB._Connection and cast the generic object that the data link returns to an ADODB._Connection.
Start Visual Studio .NET, and then create a new Visual C# Windows Application project. Form1 is added to the project by default.

From the Project menu, click Add Reference.
On the COM tab, select the following references:
Microsoft ActiveX Data Objects 2.7
Microsoft OLEDB Service Component 1.0 Type Library
If you are prompted to have a wrapper generated for you, click Yes.
Add a Button control to Form1.
Add the following code to the Button1_Click event:

MSDASC.DataLinks mydlg = new MSDASC.DataLinks();
ADODB._Connection ADOcon;

//Cast the generic object that PromptNew returns to an ADODB._Connection.
ADOcon = (ADODB._Connection) mydlg.PromptNew();

ADOcon.Open("","","",0);

if (ADOcon.State == 1) {
MessageBox.Show("Connection Opened");
ADOcon.Close();
}
else {
MessageBox.Show("Connection Failed");
}
That's it, Thanks Microsoft.

Steph.
Nov 16 '05 #4

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

Similar topics

5
by: Fred Zuckerman | last post by:
Hello All, After reading in this group about the preference for connecting to a SQL Server using a connection string instead of a DSN file, I have done just that. BUT, I cannot update my data....
5
by: Scott A. Jones | last post by:
I have an Access front end connecting to an SQL Server back-end. When the application opens, I run a small test to determine if the SQL Server is available. If it is not, I have code to trap the...
4
by: msnews.microsoft.com | last post by:
How can I call connection string (database) builder dialog?
0
by: Jay Douglas | last post by:
Hello, I'm trying to create a Data Links Property window that behaves just like the dialog box in Visual Studio .Net for MS Sql Server connections. I've found a lot of examples that use...
1
by: James Goodman | last post by:
In VB6 I used to set my applications to automatically look for the source DB in the program installation directory. If it wasnt found it was fairly easy to pop a dialog asking the user to specify the...
1
by: DaveS | last post by:
Hi! I am creating a Windows app in VS2005 which will allow the user to choose from different SQL data sources. I could hardcode a selection of connection strings, but I'd rather not (in case a...
4
by: Polaris431 | last post by:
An article is available on how to display the VS.NET 2005 Add/Modify Connection dialog at runtime. The article shows how you can include this dialog in your applications to allow users to establish...
1
by: =?Utf-8?B?VGVlcmF2ZWU=?= | last post by:
I try to invoke Connection Properties dialog box that Visual Studio 2005 use. The dialog that I said is used in many places such as when developers build connection string in Settings.setting file...
5
by: Edwin Smith | last post by:
Hello: I'm using VS2005 with an ODBC database. I am trying to add a Dialog to an existing Database application to allow the user to select the database. We have 2 different databases with the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.