Catalog name overwriting

Posts   
 
    
SpykLee
User
Posts: 8
Joined: 06-Jul-2005
# Posted on: 27-Aug-2007 23:38:19   

Hi,

I'm using version 2.5 August second edition and I'm trying the Catalog name overwriting as described in the help.

Seems that the following code in the app.config is not working properly.

<?xml version="1.0"?>
<configuration>

    <configSections>
        <section name="sqlServerCatalogNameOverwrites" type="System.Configuration.NameValueSectionHandler" />
    </configSections>

    <sqlServerCatalogNameOverwrites>
        <add key="old_db" value="new_db" />
    </sqlServerCatalogNameOverwrites>

    <appSettings>
        <add key="Main.ConnectionString" value="data source=localhost\sqlexpress;initial catalog=old_db;integrated security=SSPI;persist security info=False;packet size=4096"/>
    </appSettings>

</configuration>

Code is generated with old_db and after the code generation I renamed the db to new_db connecting with integrated security, user is dbo.

How should I setup the config file to let it work?

Cheers!

Eric

JimHugh
User
Posts: 191
Joined: 16-Nov-2005
# Posted on: 28-Aug-2007 00:15:21   

One quick suggestion:

Take initial catalog=old_db; out of the Main.ConnectionString value.

Then it will should use the inital database connection for the current user (configured through SQL Mangement Studio.

BTW, just picking nits, but dbo is the schema, not user.

Yyou know this only works for non web apps, right? Web apps use web.config.

And app.config gets copied to debug/release folder as yourappname.config

My App.config has:


<add key="Main.ConnectionString" value="Server=SERVER01;Trusted_Connection=true"/>


   <appSettings>
        <add key="Main.ConnectionString" value="data source=localhost\sqlexpress;integrated security=SSPI;persist security info=False;packet size=4096"/>
    </appSettings>

Just trying to cover a lot of the frequent issues.

SpykLee
User
Posts: 8
Joined: 06-Jul-2005
# Posted on: 30-Aug-2007 14:12:54   

Yep! That worked simple_smile

Thanks!