StrataFrame Forum

Trying to Configure Connection to 2 Different DataBases

http://forum.strataframe.net/Topic31063.aspx

By Terry Bottorff - 3/26/2012

I have the following code in my AppMain and when I first run the application it runs through the connection manager and I attach it to the correct databases. One is on the Web and one is Local.
I have a form that just uses the Web DataBase and I have the BO's DataSourceKey all set to WebProRodeoData. It works as I want it too.
Now I am setting up a form where I want to connect to my local data and I have set the BO's DataSourceKey to LocalProRodeoData2
but I get the attached error when I try to configure the BO in the BOM. 
Is there something else I should be doing?

      ConnectionManager.ApplicationKey = "ProRodeoUpdateWeb"
      ConnectionManager.ApplicationDefaultTitle = "ProRodeoUpdateWeb Connection"
      ConnectionManager.ApplicationDefaultDescription = "This application connection is used by ProRodeoUpdateWeb"
         '-- Set the required data source information so that the ConnectionManager can gather it
        '      SQL Connection
        ConnectionManager.AddRequiredDataSourceItem("WebProRodeoData""SQL Connection", _
         DataSourceTypeOptions.SqlServer, "WebRodeoData""This connection is used by Pro-Rodeo Web Data.")
         '-- Set the required data source information so that the ConnectionManager can gather it
        '      SQL Connection
        ConnectionManager.AddRequiredDataSourceItem("LocalProRodeoData2""SQL Connection", _ 

         DataSourceTypeOptions.SqlServer, "LocalRodeoData""This connection is used by Pro-Rodeo Local Data.")

TIA.

By Edhy Rijo - 3/26/2012

Hi Terry,
The database connection in the BOM has nothing to do with the connection in your AppMain.vb file.  The BOM only needs to get a connection to a database with the same data structure as the one you will be using in your application so it can read the table schema and create the BO fields for you.  If you would use the DDT, then you should map your BOM to the DDT instead of the database except for views which will need to be read from any database.

So bottom line is this:
  1. Make sure the BOM connection is to any local database that has the same structure as expected for your application.
  2. The connections in your AppMain.vb looks just fine.
By Terry Bottorff - 3/26/2012

Yes Sir Edhy a Direct Hit. Just like always exactly what it took to fix the problem. Thank you so much.
By Edhy Rijo - 3/26/2012

You are welcome Terry, glad it worked out for you.