problem with connectionstring

Posts   
 
    
mafti
User
Posts: 38
Joined: 27-Oct-2004
# Posted on: 02-Feb-2005 11:56:06   

Hi there,

on my testserver it works allright, only on the production server i have to change the web.config.

is there an easy way to have 2 connectionstrings, the only difference is basically the location of the sqlserver and port. the databases are identical.

so basically it tries the first connectionstring, when it gets an error, it tries the 2nd when etc...

or is there a better way to do this?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 02-Feb-2005 12:57:45   

You want this for developing? It's not that great I think if for every call the code first tries to connect to a server which it can't connect to.

You can do something along the lines of: (selfservicing) - read the first connection string from the .config file - create a connection using DbUtils --- fails? -> read other one and set that value in DbUtils.ActualConnectionString --- succeeds? -> set the read connection string as value in DbUtils.ActualConnectionString

In adapter it works slightly different: you there create a factory which produces DataAccessAdapter instances, and you feed the instance you create there the connection string to use.

Frans Bouma | Lead developer LLBLGen Pro