Change Database Via Connection String

Posts   
 
    
Posts: 1
Joined: 27-Sep-2007
# Posted on: 27-Sep-2007 17:12:23   

I'm a potential LLBLGen Pro customer. From the generated code that I saw on the trial version, it seems that the database (i.e. not just table) is in the code that is generated from our current database.

Therefore I have one question:

Is it possible to specify the username/password/and database of the connection string at runtime? The various databases that the user would need to access have identical table structures.... If that is possible, could you give me a basic idea of how hard that is to do?

Thank you!

Faldaani
User
Posts: 14
Joined: 18-Sep-2007
# Posted on: 27-Sep-2007 18:56:03   

I deleted the app.config file generated, and instantiate the data adapter with this

// Constring, keep open, catalog name usage, catalog name to use if set to force
new DatabaseSpecific.DataAccessAdapter(conString, true, SD.LLBLGen.Pro.ORMSupportClasses.CatalogNameUsage.Clear, "");

Constring includes username, password and database to use.

I'm sure there are better ways =)

EDIT: Help file, "Using generated code -> Adapter -> Connection strings" or "Using generated code -> Application configuration through .config files" for more options