Pull from second database

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
10/14/2015 6:22:36 AM
Gravatar
Total Posts 118

Pull from second database

Hi, I would like to add a section to the homepage that imports something from a different database. Is it just a case of adding the .net code to my homepage skin? 

Am I going to run into problems before I start doing this? Has anyone done it before? Is there an easier way of doing it?

Any help appreciated.

10/14/2015 8:44:36 AM
Gravatar
Total Posts 18439

Re: Pull from second database

Don't add any code directly to layout.master, create a UserControl ie a .ascx and embed that in layout.master then your logic can be inside your usercontrol.

10/14/2015 8:55:15 AM
Gravatar
Total Posts 118

Re: Pull from second database

Thanks Joe that's great. To initiate a second db connection, would I just add a second connection in web.config and reference that in my .ascx file?
10/14/2015 9:00:19 AM
Gravatar
Total Posts 18439

Re: Pull from second database

you can do whatever you want in your own code.

myself I don't access the db directly from the UI layer. I have the UI talk to a business layer class which talks to a data access class and the data access class would get its connection string from a config setting. so yes you would need a separate config setting for your different connection string. you could put all your code in the usercontrol but that is not how I do things myself.

You must sign in to post in the forums. This thread is closed to new posts.