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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0error connecting to databaseerror connecting to database
Previous
 
Next
New Post
2/29/2008 11:43 AM
 

I am trying to create a module that will access a different database then the core DNN database. 

I added the connection string to the web.config.  I put the following code in the sqldataprovider.vb for the module I created

 

_connectionString = Config.GetConnectionString("StarkConnectionString")

 

When I try to run the web site, it says that there was a critical error and no data is being displayed for any of the other modules, as if now it is using the above connection string across the entire web site instead of just within this module.  What am I doing wrong and what should I be doing?

Also, if the database that I am trying to connect to is a SQL database, then do I need to declare a separate data provder or would the default dataprovider be the correct provider.

Thanks Judith

 

Dim objProvider As Framework.Providers.Provider = CType(_providerConfiguration.Providers(_providerConfiguration.DefaultProvider), Framework.Providers.Provider)

'Get Connection string from web.config

 
New Post
2/29/2008 7:03 PM
 

Hi there,

This was answered for you in the other post you made about this. You have to change your provider (look just about where you changed the connection string and you'll see where the default provider is configured. The default provider maps to "sitesqlserver" in you web.config file. Yes, this is a sql server. "provider" means a specific instant of a sql server.

You need to modify the web.config to add the other server. Look for the "data/providers" section in web.config and add the other server.

1. add the connection string,key, and provider info for the second sql server to web.config

2. change the provider name in the sqldataprovider.vb file right above where you changed the connection string

3. go to the downloads section here, download the documentation, and start reading. you're gonna run into a lot of grief if you keep tinkering with your modules without having the most basic understanding of how they work

 
New Post
2/29/2008 11:01 PM
 

Save yourself and your module users a lifetime of misery by not putting anything into web.config.  Use module settings instead to store your values.  That way each instance of your module can connect to any database and can be changed at anytime without impact to the rest of your DNN installation.

 
New Post
3/3/2008 10:08 AM
 

>>Save yourself and your module users a lifetime of misery by not putting anything into web.config.  Use module settings instead to store your values.  That way each instance of your module can connect to any database and can be changed at anytime without impact to the rest of your DNN installation.<<

 

What module settings would be the correct ones to set and where can I  look to find that out?

Thanks

 
New Post
3/3/2008 12:50 PM
 

Using module settings is a nice idea. Look for the settings.ascx web control that was created along with your other controls (assuming you used the dnn template to create your module). There wont be any specific settings already there, you'll need to write the code yourself. I'm new to this myself but I imagine it'll just involve adding a couple of text boxes for the provider info and connection string to the settings control then changing sqldataprovider.vb so that it looks at the module settings instead of the default provider.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0error connecting to databaseerror connecting to database


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