Dynamic ConnectionString in DataAdapter only works with appSettings ?

H

heikekrieg

Hi all,

i have to load my connectionString from Config dynamically.
We are using many DataAdapters on different Forms and we have to
change from development to production and vice versa.

The only way to set the connectionString dynamically from app.config
is to set it in the property browser (dynamic settings -
connectionString).

BUT this entry will only write to the appSettings in the config file.
We dont want to include the password in the appSettings so we want to
have our own configSettingsHandler to read the connectionString from a
class (Serialization).
This is not available cause in the appSettings we can't handle any
entry with a own handler ...

Any solutions how to solve this problem?

(Our only solution is to parse all sourcefiles and change the
hardcoded entry from the DataAdapter Wizard into any static access to
a class Classname.ConnectionString....

Thx all
 
R

Ravikanth[MVP]

Hi

You can always use encrypted password(encypt using some
alogirthms) in Config file.


HTH
Ravikanth
 
H

heikekrieg

No i can't.

The wizard can't decrypt the password from the configuration file
automatically.
Wizard only can map a appSettings entry to the ConnectionString
property and this is not enough because your encrypted password has to
be decrypted (there is no automatism - the developer has to decrypt it
manually and this is a very dangerous thing).

Ralf
 
J

John Saunders

I'm curious. Why not keep the password in the config file? Shared hosting
environment?
 
J

John Saunders

If the encrypted password were in the config file, your code could decrypt
it before use.

Now, this does leave the problem with actually _using_ the connection in the
designer. I don't know of a good solution for that. It also doesn't play
well with user.config.

--
John Saunders
Internet Engineer
(e-mail address removed)
 
J

John Saunders

Independant of the question of MSI or of appSettings, how do you _want_ to
distribute the passwords? They have to have _some_ way of getting out to the
client.

Perhaps the following will work:

1) Magically distribute the password to the client program.
2) Have the connection string in appSettings with no password (or with a
password which only works on your development systems)
3) Have the client program get the connection string from appSettings and
have it append "pwd=" & thePassword to the string
4) Open the connection as normal

This allows you to use the designers, specify either no password or a safe
password in appSettings, and then use the deployed password on the deployed
client.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top