Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use SaveSettings for ODBC

Status
Not open for further replies.

GerardMcL

Technical User
Aug 5, 2004
212
IE
Hi,

I was told these functions were best way to edit registry.
I have an application where the user selects a database and this causes (or at least should cause) an ODBC connection to be pointed at this database.

How can I do this using these functions?? Or are there better ways??

Im basically saying something like

ExampleDSN.default database = Testdb

Any help is greatly appreciated and unfortunatley I have no experience at editing the registry using VB6!
 
The VB GetSettings and SaveSettings can only be used in a very limited part of the registry (HKEY_CURRENT_USER\Software\VB and VBA Program Settings\)

To access other parts of the registry use the Reg APIs. There are full details and some VB examples at :

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
>To access other parts of the registry use the Reg APIs

Well ... yes, although for much of the functionality of the registry we can look at the Windows Script Host Object library which gives us RegRead, RegWrite, and RegDelete access to just about any part of the Registry to which we have permissions (although compared to the API certain more advanced functionality is missing, e.g. enumerating keys)

That being said, ODBC connections are not stored in the registry ...
 
maybe they mean:

System DSN
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC
or
User DSN
HKEY_CURRENT_USER\Software\ODBC
 
Erm ... I read the question quickly and was assuming the user was refering to connection strings when they said connection, but if they want the component details of the DSN (as the one line example in the post indicates) then yep, you are quite right

I still think creating your own connection string and saving that in the VB areas of registry can be a simpler solution. Creating and modifying connection strings in VB is pretty easy to do, as I illustrated in thread222-595040
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top