Dynamically connect to different databases


Author
Message
Michel Levy
Michel Levy
Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Hi,

I'm a french absolute beginner in both StrataFrame and VB.Net (but 23 years with Clipper and Fox)...

Data are on several databases on SQL Server (DataBcuv1, DataBcuv2, ...) and global parameters are in ParaBcuv on the same Server. The most important of these is the correspondence between "folder" ID and database name (first folder may be linked to databcuv4, if my customer requires it).

In my main form, I launch (in its shown method) a form "choixdossier" as showdialog(), to chooses working folder (i.e. database), and I return a connect string in a property of my main form.

I use one BO for this first connection to parabcuv, and I need to dynamically re-set the connection strings of all BO to databcuv which are used in all forms in that application (all BO are in a BO library referenced in final application).
But method SetDataSources is in appmain.vb, not in my main form :-(

How can I do that?

Replies
Michel Levy
Michel Levy
Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
OK Greg,

now I understand what you were talking about (all my apologies for misunderstanding, but english is not my native language), and it seems to be exactly what I was looking for.

I'll try it tomorrow (it's 9 PM here, time to stop working Doze ) and give a feedback.

Thanks

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
nowI understand what you were talking about (all my apologies for misunderstanding, but english is not my native language), and it seems to be exactly what I was looking for.




No worries. I had all sorts of misunderstandings like this when I started. I think you're doing great!



I'll try it tomorrow (it's 9 PM here, time to stop working Doze ) and give a feedback.




Bon Chance et Bon Nuit!



(and that's about it for my français)
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yep, Greg is absolutely right (once again Wink).  If you change the ConnectionString property on a DataSource, you're not guaranteed that it's going to be updated throughout the application (it gets cached off for speed so it doesn't need to be looked up every time).  So, instead, remove the DataSource and re-add it to the DataSources collection, just like in Greg's sample, and all of the business objects will update and start using the new data source.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search