# VB6 Databound controls



## Royv (Jul 5, 2003)

I'm trying to use databound controls to develop a query/update system for a database which has a password. How do I supply the password?


----------



## coderitr (Oct 12, 2003)

The password is part of the connection string to the database. If you don't want to hard-code it into your program then you'll have to prompt the user for database authentication credentials then set the connection string property of your database connection object dynamically.


----------



## Royv (Jul 5, 2003)

I'm sorry I haven't explained properly. I've coded database applications in other programs using connection strings & supplying my own code to handle everything. Here, I'm trying to use a data control & there's nowhere in the properties box to add a password. I supply the database name but, when I try to type in the record source, it gives me a 'Not a valid password' error. I've tried adding the password to the database name in various ways but all get rejected.
I'm not very well up on the use of databound controls & would appreciate some further help.


----------



## coderitr (Oct 12, 2003)

Are you using DAO or ADO? If ADO then the password is part of the connection string.


----------



## Royv (Jul 5, 2003)

I'm using DAO.


----------



## coderitr (Oct 12, 2003)

The only way that I can find to do what you want is the access the database through ODBC. Then you can specify the entire ODBC connection string, including the password, in the connect property of VB's intrinsic data control and leave the DatabaseName property blank.

I recommend, however, using ADO. MS is phasing out support for DAO and moving forward, ADO will allow you to use an alternate database solution without changing your code. With ADO, once the initial connection is made to the database, the access code is written the same way regardless of what the underlying database engine happens to be. In short, with ADO, the developer doesn't need to care what type of database the target is.


----------



## Royv (Jul 5, 2003)

Thanks for your help. I'll start looking into ADO & convert to that before continuing with this project.


----------

