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.0Problem using multiple connection stringsProblem using multiple connection strings
Previous
 
Next
New Post
5/27/2008 4:54 PM
 

I tried to create a custom module "MyLogin".  After passing DotNetNuke login, it should automatically check if the user is available for my login database. So I need to keep DotNetNuke connection, at the same time, need another connection string because my login module uses another database on the different server than DotNetNuke database. My problem is it always accesses DotNetNuke database, I cannot get my login database connection string.

Here is what I did.  

In web.config, I added section name SecurityLogin which is outside of <sectionGroupname="dotnetnuke">.

<sectionname="SecurityLogin"type="System.Configuration.SingleTagSectionHandler, system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null" />

I also added the code within <connectionStrings>.

<addname="SecurityLogin"connectionString="Data Source=127.0.0.1;Initial Catalog=xxx;User ID= xxx;Password= xxx "providerName="System.Data.SqlClient"/>

Below code was added in <appSettings>.

<addkey="SecurityLogin"value="Data Source=127.0.0.1;Initial Catalog=xxx;User ID=xxx;Password=xxx"/>

I created a module MyLogin. In mylogin/sqlprovider.vb, I added the code:

Private Const ProviderType As String = "SecurityLogin"

_connectionString = ConfigurationManager.AppSettings("SecurityLogin")

In myLoginController.vb file, I have a function:

Public Function [Get](ByVal loginid As Integer) As tblloginInfo
            Return CType(CBO.FillObject(DotNetNuke.Data.DataProvider.Instance().ExecuteScalar("tblloginGet", loginid), GetType(tblloginInfo)), tblloginInfo)

End Function

But this code always calls DataProvider.vb and SQLDataProvider.vb under Library but not mylogin/DataProvider.vb and  mylogin/SQLDataProvider.vb. Can anyone help? why I can not get mylogin connection?

Thanks very much for any helps!!!
 
 
New Post
5/28/2008 4:49 AM
 

By default - DNN does NOT support accessing multiple data sources at the same time thru the SQLDataProvider.  

Which means that utilising the SQLDataProvider and DAL methodology for accessing a second database is not really appropriate.

There is however a way to utilise the DAL+ methodology and the SqlHelper.ExecuteReader() method
to do pretty much what you are looking for.

Have a look at the website below for more into on DAL+ and alternative databases.

http://www.adefwebserver.com/DotNetNukeHELP/DAL_and_DAL_Plus/Alternate_Database.htm

Note: DAL+ gives you most of the benifits of the DAL meothodology - but without alternative dataprovider support for oracle etc.
but for many people that is not a major issue since there seem to really be very few module developers that have the ability
or desire to create all the approriate support elements for multiple dataprovider support anyway.

PS - while still a work in progress in some respects LINQtoSQL will hopefully soon make all other DAL
solutions redundant - yes its still got some issues at the moment - but really fells like a much more elegant solution for the long term.
LINQtoSQL has cross dataprovider support - but does still have some issues with things like handleing prefixes and such

 
New Post
7/2/2008 10:16 AM
 

 

O.K. I found the inf0rmation from this site, it really works. I can access 4 different databases on the separate servers. Please see more inf0rmation from this link.

http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/111/threadid/121219/scope/posts/Default.aspx

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Problem using multiple connection stringsProblem using multiple connection strings


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