| View previous topic :: View next topic |
| Author |
Message |
Bill Cart Guest
|
Posted: Tue Mar 08, 2005 3:24 pm Post subject: User setup of SQL connection string |
|
|
We have a program we plan on distributing to other agencies. We have done
this before with MS Access but now we want to use SQL server. While
developing the application we have been using Data Link files. What is the
best way of letting a user (or most likely in this case their IT group) set
up the database connection string: a Data Link file, a text file or some
other way? Any thoughts or experiences to pass along?
|
|
| Back to top |
|
 |
Eric Hill Guest
|
Posted: Tue Mar 08, 2005 3:53 pm Post subject: Re: User setup of SQL connection string |
|
|
Use UDL files. They are *very* handy and the OS does the work for you.
Your ADOConnection just uses 'File Name=someudlfile.udl' for the connection string. You can
ShellExecute the udl file and Windows will pop up the configuration box complete with a test button.
They work for ODBC and OLEDB data sources. They are text files so you can "clone" them with a
TStringList. That are also INI files so the TIniFile works like a charm with them. A
TFileOpenDialog (is that the right name?) with a "Data Link Files|*.udl" mask will let the user
choose an available connection. Creating a new connection is as simple as creating an empty file
and ShellExecuting it. You can do OS permissions on the files so company-defined UDL files can only
be changed by an administrator.
The list goes on, but suffice it to say that I really like using UDL files.
Eric
|
|
| Back to top |
|
 |
Bas van Beek Guest
|
Posted: Tue Mar 08, 2005 4:50 pm Post subject: Re: User setup of SQL connection string |
|
|
I usually have registry settings to get/set the connectionstring and
have the standard connection setup box pop up at the user interface if
they need to change settings or if a connection fails.
try this:
newConnString := PromptDataSource(Self.Handle, oldConnString);
Regards,
Bas van Beek
Bill Cart wrote:
| Quote: | We have a program we plan on distributing to other agencies. We have done
this before with MS Access but now we want to use SQL server. While
developing the application we have been using Data Link files. What is the
best way of letting a user (or most likely in this case their IT group) set
up the database connection string: a Data Link file, a text file or some
other way? Any thoughts or experiences to pass along?
|
|
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Tue Mar 08, 2005 5:11 pm Post subject: Re: User setup of SQL connection string |
|
|
Be very careful about including the password in the UDL file.
--
Bill Todd (TeamB)
TeamB cannot answer questions received via email
|
|
| Back to top |
|
 |
|