Displaying database name in VB.NET

Posts   
 
    
JMitchell avatar
JMitchell
User
Posts: 128
Joined: 01-Sep-2006
# Posted on: 22-Sep-2006 12:53:45   

Is it possible to find the database name?

The reason I am asking is, we have a live database and a development one and, whilst we can switch between the two by changing the connection string key in App.config, I'd like to be able to make it obvious when we're using the development database. If there's no way to do it with the generated code I'll have to parse the connection string.

Cheers,

James

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 22-Sep-2006 16:04:31   

First of all you can't switch between databases using the connection string. Instead you should use Catalog names overwrites in the config file too. Please refer to the manual "Using the generated code -> Application configuration through .config files"

At runtime you can get the source catalog name from any field you have. (remember you can entities from more than one catalog in the same project)

All you have to do is to use the SourceCatalogName property of the EntityField (SelfServicing)

Or the same property but of the FieldPersistenceInfo of any entityField2 (Adapter)

JMitchell avatar
JMitchell
User
Posts: 128
Joined: 01-Sep-2006
# Posted on: 22-Sep-2006 17:50:31   

Walaa wrote:

First of all you can't switch between databases using the connection string. Instead you should use Catalog names overwrites in the config file too.

It seemed to work...

Might it be because I'm using version 1.0.2005.1?

I am having problems now in that I want to update the generated code based on changes in the development database.

I don't suppost there's an easy way to change an LLBLGen Pro project to a different database? If we create a new project we'll lose the changes we've made to the existing project file...

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 22-Sep-2006 18:55:40   

JMitchell wrote:

Walaa wrote:

First of all you can't switch between databases using the connection string. Instead you should use Catalog names overwrites in the config file too.

It seemed to work...

Might it be because I'm using version 1.0.2005.1?

I am having problems now in that I want to update the generated code based on changes in the development database.

Could you elaborate on what kind of problems?

I don't suppost there's an easy way to change an LLBLGen Pro project to a different database? If we create a new project we'll lose the changes we've made to the existing project file...

You can do that, simply go to the catalog explorer and rename the catalog to the catalog you want to refresh with, then refresh the project again. You can point to a different server if you want.

Frans Bouma | Lead developer LLBLGen Pro