Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesGet default connection from module development projectGet default connection from module development project
Previous
 
Next
New Post
3/29/2011 3:12 AM
 
I am building a module as a separate project (as explained in one of the dnn videos) and just referencing a bin folder of my web application listed as dnndev website on my local machine. I use module development template supplied by Chris Hammond. All works well, appart from the database stuff. I can make a new connection and use it from the module, but that is no good for the live site. I beleive I will need to know what is the default connection in the dnn web site, so I can use it. How do I get that during both, design time and runtime?
Alex
 
New Post
3/29/2011 5:51 AM
 
Boranin

Probably it is not good idea to establish connection yourself. You should use SqlHelper from the Microsoft.ApplicationBlocks.Data. It works good and you do not need to worry about default connection at all.

Sergey
 
New Post
3/29/2011 8:54 AM
 
In addition to making use of the SqlHelper class from Microsoft.ApplicationBlocks.Data, you will still need to obtain the default database connection string from web.config. The DotNetNuke core API provides a handy method for doing just that:

Dim connectionString As String = DotNetNuke.Common.Utilities.Config.GetConnectionString()

If you are building a one-of-a-kind module for one of your own installations, that should be enough. However, if building a module that may be installed in a variety of sites, you will also need to handle cases where a databaseOwner token other than "dbo" and/or an objectQualifier token has been specified in the providers section of web.config. Take a look at the data provider implementation source code (usually in a class file named SqlDataProvider.vb) of any of the more recent core modules (available for download from their individual CodePlex project sites) to see how this is handled.

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesGet default connection from module development projectGet default connection from module development project


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out