StrataFrame Forum

BO To Connect To Tables in Different Databases

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

By Jeff Pagley - 10/3/2007

Hi StrataFrame Team,

I have multiple databases running on a single SQL Server 2005 machine.  I need to have a master database with master tables that all other databases/applications use.  How do I setup my BO connections so that within the project/application which is using tables from one database I can access the master tables residing in the master database?

Thanks,

jjp

By Trent L. Taylor - 10/4/2007

You will want to create multiple data sources and then tie your BOs DataSOurceKey property to the correct connection.  This can be done programmatically at run-time as well.  First setup your data sources:

DataBasics.DataSources(New SqlDataSourceItem("","My SqlConnection;Database=ApplicationSpecific;"))
DataBasics.DataSources(New SqlDataSourceItem("MASTER","My SqlConnection;Database=Master;"))

Next, on the BO you will want to assign the the DataSourceKey to any BO that needs to talk with the MASTER instead of the default ("" - Empty String By Default) connection.  You can set this on the property sheet of the BO or set it in code:

MyBO.DataSourceKey = "MASTER"
By Jeff Pagley - 10/4/2007

Thanks for the info Trent!
By Trent L. Taylor - 10/4/2007

No problem Smile