Wednesday, March 28, 2012

Professionally Handling ADO Logins

Hello -- I'm curious to know how most folks write VB code to connect to
their database using ADO without hardcoding the values in the application.
I frequently see books that allow the user to enter a username/password
within a login form and pass this information to the Conneciton object
Open() method. However, they then turn around and hardcode the server
name!!!
It would appear even attempting to use ADO Bound Controls in a professinoal
application is totally out of the question; since you must set the
connection info at design-time within its properties.
I was wondering if it made sense to display a logon form requesting the
login name/password, and then having a combo box that enumerated all the SQL
Servers on the network using SQLDMO. The users selection can be saved to
the registry or to an INI file and pre-filled in the box the next time the
application is executed...
Any help, ideas, or feedback would be appreciated.
--
...david
I you wish to reply to me personnally, please remove
the "underline" from scandal_123@.cox.net. The is done to avoid SPAM!I think there are multiple options you have for making the connection to the
database transparent to your application.
(1) You could use a DSN name in your code and possibly show the user the
list of configured DSN's in the system and then connect based on the user
selection.
(2) You could use a UDL file that contains information regarding the login
information.
(3) You could collect user-name, password and also show the list of servers
in the network for the the user to select and then form the connection
string yourself based on the input parameters and then connect.
In my experience, I've found (1) and (3) to be most popular.
--
HTH,
SriSamp
Please reply to the whole group only!
http://www32.brinkster.com/srisamp
"DavidM" <scandal_123@.cox.net> wrote in message
news:%234KT5atoDHA.2216@.TK2MSFTNGP12.phx.gbl...
> Hello -- I'm curious to know how most folks write VB code to connect to
> their database using ADO without hardcoding the values in the application.
> I frequently see books that allow the user to enter a username/password
> within a login form and pass this information to the Conneciton object
> Open() method. However, they then turn around and hardcode the server
> name!!!
> It would appear even attempting to use ADO Bound Controls in a
professinoal
> application is totally out of the question; since you must set the
> connection info at design-time within its properties.
> I was wondering if it made sense to display a logon form requesting the
> login name/password, and then having a combo box that enumerated all the
SQL
> Servers on the network using SQLDMO. The users selection can be saved to
> the registry or to an INI file and pre-filled in the box the next time the
> application is executed...
> Any help, ideas, or feedback would be appreciated.
>
> --
> ...david
> I you wish to reply to me personnally, please remove
> the "underline" from scandal_123@.cox.net. The is done to avoid SPAM!
>

No comments:

Post a Comment