> When I used DAO, you could ask to open the database with "ODBC;" as
> the string, and a system dialog appeared to enable you to select an
[quoted text clipped - 4 lines]
> similar to the MS Common Dialogs that you can invoke to browse for
> files?
I assume the dialog you are talking about is the "ODBC Data Source
Administrator" which creates DSNs or "Data Source Names". There is one
problem with this dialog and that it opens and creates ODBC connections
using ODBC Drivers.
ADOuses OLE DB Providers. If available for your database, always use an OLE
DB Provider with ADO. It is possible to use an "OLE DB for ODBC" provider
but this only adds another layer of indirection and occasionally limits
available features.
So the OLE DB conterpart is the "Data Link Properties" dialog, which serves
as a front-end for building connection strings using OLE DB Providers. To
launch the dialog just create a blank file with the .udl extension. ('udl'
stands for universal data link). Then open it.
Shell "junk.udl"
[Note: just an example you will likely want to use shellexecute and wait or
Find...Change Notification. If you need help on that post again.]
Windows file association while take care of the rest and the dialog will
open when closed the .udl file will contain the connection string.
Open the file grab the string and a way you go! <g>
-ralph
Richard M. Hartman - 04 Sep 2007 18:08 GMT
> > When I used DAO, you could ask to open the database with "ODBC;" as
> > the string, and a system dialog appeared to enable you to select an
[quoted text clipped - 25 lines]
> open when closed the .udl file will contain the connection string.
> Open the file grab the string and a way you go! <g>
I will see what I can do with this, but I would really prefer a DLL entry
point to invoke -- something similar to the common file dialog.

Signature
-Richard M. Hartman
hartman@onetouch.com
186,000 mi/sec: not just a good idea, it's the LAW!
Ralph - 04 Sep 2007 19:01 GMT
<snipped>
> I will see what I can do with this, but I would really prefer a DLL entry
> point to invoke -- something similar to the common file dialog.
After you said that I got to thinking there was another way as well ...
http://support.microsoft.com/kb/286189
-ralph
Franck - 12 Sep 2007 20:19 GMT
easy what you want is this simple line :
shell("%SystemRoot%\system32\odbcad32.exe")
this will open the odbc config panel wich also can be found in :
Control Panel / Administrative Tools / Data Sources (ODBC)
you obviously need admin rights to pass by control panel but i think
anyone can run it trough this command line but wont be able to modify
or delete only create new if not admin.
William (Bill) Vaughn - 15 Sep 2007 23:09 GMT
My question would be: "Why?"
Are you writing a general purpose utility or can't you just build a DSN-less
connection in code using the appropriate provider?

Signature
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
> easy what you want is this simple line :
>
[quoted text clipped - 5 lines]
> anyone can run it trough this command line but wont be able to modify
> or delete only create new if not admin.
Ralph - 16 Sep 2007 01:16 GMT
> My question would be: "Why?"
> Are you writing a general purpose utility or can't you just build a DSN-less
> connection in code using the appropriate provider?
<snipped>
Yes one could write a Data Link Dialog replacement to duplicate look and
feel, and function, but then the question again becomes Why?
When you can just use the one provided by the O/S?
-ralph
William Vaughn - 17 Sep 2007 18:29 GMT
My question was why interact with the user who (unless you're writing a
programming tool) is the person least likely to know what to do? Why not use
a DSN-less connection?

Signature
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
>> My question would be: "Why?"
>> Are you writing a general purpose utility or can't you just build a
[quoted text clipped - 9 lines]
>
> -ralph
Ralph - 17 Sep 2007 18:49 GMT
> My question was why interact with the user who (unless you're writing a
> programming tool) is the person least likely to know what to do? Why not use
> a DSN-less connection?
<snipped>
The OP requested a Dialog for ADO/Providers analogous to the Dialog provided
for ODBC.
Whether that was a good idea or not within the OP's domain was never a
question. And since the OP is using OLE DB, DSN or DSN-less was never a
question either.
-ralph
Ralph - 16 Sep 2007 01:13 GMT
> easy what you want is this simple line :
>
[quoted text clipped - 5 lines]
> anyone can run it trough this command line but wont be able to modify
> or delete only create new if not admin.
The OP is looking for a Data Link dialog, not the ODBC one.
-ralph
Richard M. Hartman - 21 Sep 2007 00:42 GMT
That would enable the user to configure a connection, but would not return a
selected connection name to the app.

Signature
-Richard M. Hartman
hartman@onetouch.com
186,000 mi/sec: not just a good idea, it's the LAW!
> easy what you want is this simple line :
>
[quoted text clipped - 5 lines]
> anyone can run it trough this command line but wont be able to modify
> or delete only create new if not admin.
brm013 - 26 Sep 2007 03:08 GMT
I have been looking for a similar thing (I think) and stumbled across
this article: http://www.codeproject.com/cs/database/DataLinks.asp
It does exactly what I want, hope it helps here?
I am starting out using ADO so I don't know if this will help you.
FileN$ = "Your FileName and Path"
ADO_DataWords.ConnectionString = "Provider=Microsoft.Jet.OLEDB.
4.0;Data Source=" & FileN$ & ";Persist Security Info=False"
ADO_DataWords.RecordSource = "SELECT * FROM
[YourTableNameHere]"
ADO_DataWords.Refresh
After you draw a ADO data control on your form, you can move to the
object properties and select the connection property. A 3 period
button will appear, that when opened will help you build a connection
string to suit your purposes.
Richard M. Hartman - 04 Sep 2007 18:07 GMT
It's the stuff you want to give to "DATASOURCE=" that I want to enable the
user to select. The thing you have represented there by "FileN$". How do
you allow the user to select which datasource to use?

Signature
-Richard M. Hartman
hartman@onetouch.com
186,000 mi/sec: not just a good idea, it's the LAW!
> I am starting out using ADO so I don't know if this will help you.
>
[quoted text clipped - 9 lines]
> button will appear, that when opened will help you build a connection
> string to suit your purposes.