PC Review


Reply
Thread Tools Rate Thread

Dynamic ConnectionString in DataAdapter only works with appSettings ?

 
 
heikekrieg
Guest
Posts: n/a
 
      23rd Jul 2003
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
 
Reply With Quote
 
 
 
 
Ravikanth[MVP]
Guest
Posts: n/a
 
      23rd Jul 2003
Hi

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


HTH
Ravikanth


>-----Original Message-----
>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
>.
>

 
Reply With Quote
 
heikekrieg
Guest
Posts: n/a
 
      23rd Jul 2003
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

"Ravikanth[MVP]" <(E-Mail Removed)> wrote in message news:<08da01c350fa$4b6ac380$(E-Mail Removed)>...
> Hi
>
> You can always use encrypted password(encypt using some
> alogirthms) in Config file.
>
>
> HTH
> Ravikanth
>
>
> >-----Original Message-----
> >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
> >.
> >

 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      23rd Jul 2003
I'm curious. Why not keep the password in the config file? Shared hosting
environment?

--
John Saunders
Internet Engineer
(E-Mail Removed)


"heikekrieg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      23rd Jul 2003
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 Removed)


"heikekrieg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
> "Ravikanth[MVP]" <(E-Mail Removed)> wrote in message

news:<08da01c350fa$4b6ac380$(E-Mail Removed)>...
> > Hi
> >
> > You can always use encrypted password(encypt using some
> > alogirthms) in Config file.
> >
> >
> > HTH
> > Ravikanth
> >
> >
> > >-----Original Message-----
> > >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
> > >.
> > >



 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      24th Jul 2003
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.
--
John Saunders
Internet Engineer
(E-Mail Removed)


"heikekrieg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi John,
>
> our application is a client application (with a centralized deployment
> and a msi installer). So we cant outsource the configs cause if the
> network etc. is broken (sometimes this happens :-) ) the client
> application cant work correctly.
>
> We only need a solution like this:
> 1) Work with DataWizard
> 2) DataWizard creates DataAdapter, Connection, Commands etc.
> 3) ConnectionString is taken from DB explorer or mapped to app.config
> (and there only to appSettings).
> 4) If we map to appsettings where do we get our password from (in an
> automatic manner - we dont want to go into source code etc.)
> The problem is that there is no process to set a dynamic
> connectionstring and to encrypt/decrypt the password in the framework.
>
> So what can we do ?
> 1) Dont use the wizard and use a own db framework (that is not well
> cause the wizard has some advantages)
> 2) Write a helper tool that replaces the wizard generated
> connectionstring with a static access like xxx.ConnectionString =
> ConfigSettings.ConnectionString;
>
> I dont understand that there is no solution - there are many projects
> out here and they must have same problems (or they dont use wizard)
>
> Cheers
>
>
>
> "John Saunders" <(E-Mail Removed)> wrote in message

news:<(E-Mail Removed)>...
> > I'm curious. Why not keep the password in the config file? Shared

hosting
> > environment?
> >
> > --
> > John Saunders
> > Internet Engineer
> > (E-Mail Removed)
> >
> >
> > "heikekrieg" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic connectionstring with Dataset Wizards ? (VS2005) Sagaert Johan Microsoft C# .NET 2 25th May 2006 12:36 PM
AppSettings file="user.config" for connectionstring in .NET2.0 mortb Microsoft ADO .NET 2 20th Apr 2006 09:41 AM
DataAdapter Mapping only works for the first two tables. vrjaya@hotmail.com Microsoft ADO .NET 3 6th Feb 2006 04:33 PM
dataAdapter not updating - but sqlcommand works OK =?Utf-8?B?UmljaA==?= Microsoft ADO .NET 8 4th Feb 2006 06:44 PM
Dynamic Connectionstring in Web.Config ? summer00 Microsoft ASP .NET 2 25th Feb 2005 06:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:16 PM.