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.0DAL+ - extra database connectionDAL+ - extra database connection
Previous
 
Next
New Post
12/7/2006 2:43 PM
 

I am going to take back my last statement I think if you are wanting to do this then a simple update to the sqldataprovider in the dataproviders folder could do it

 

If you look at SQLDataProvider.vb in \DotNetNuke_4.3.7_Source\Library\Providers\DataProviders\SqlDataProvider

You could add a property for a definable connection string then create another ExecuteReader Function?  How do you do that so they can have multiple overrides - or make that one have a flag to use your defined connection string - something like that -

So It might look like this

 Public Overrides Function ExecuteScalar(ByVal ProcedureName As String, ByVal ParamArray commandParameters() As Object,Optional ByVal ConnectionFlag=False) As Object

If ConnectionFlag then
            Return SqlHelper.ExecuteScalar(UserInputConnectionString, DatabaseOwner & ObjectQualifier & ProcedureName, commandParameters)

'UserInputConnectionstring i defined in the properties as a normal read/write porperty

Else

               Return SqlHelper.ExecuteScalar(ConnectionString, DatabaseOwner & ObjectQualifier & ProcedureName, commandParameters)

End If
        End Function


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
12/7/2006 3:37 PM
 

I can't see anyway of doing this without modifying the core (which i hate to do). I think ideally you should be able to pass it like this:

DotNetNuke.Data.DataProvider.Instance("NewData").ExecuteReader("GetSurvey", SurveyID, ModuleId)

"NewData" would be your other db connection in the web.config. If it is blank, then it would use the default, which is "data".

 
New Post
12/7/2006 4:44 PM
 

Currently, I don't have access to the current source, but it looks like if we can change the Instance() method to allow a parameter in, it can be switched to the new datasource. Can anyone come up with an example of how best to do this?

I'm suprised this hasn't come up yet. I think it would be a common practice to have your module store/retrieve data outside of the dotnetnuke database. Should we log this in gemini?

Anyways, for those who don't know, this is how you would modify the web.config file

<configSections>

<sectionGroup name="dotnetnuke">

<section name="data" type="DotNetNuke.ProviderConfigurationHandler, DotNetNuke" />

<section name="newdata" type="DotNetNuke.ProviderConfigurationHandler, DotNetNuke" />

...

</configSections>

<dotnetnuke>

...

<data defaultProvider="SqlDataProvider">

<providers>

<clear/>

<add name="SqlDataProvider"

type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider"

connectionStringName="SiteSqlServer"

upgradeConnectionString=""

providerPath="~\Providers\DataProviders\SqlDataProvider\"

objectQualifier="dnn_"

databaseOwner="dbo"/>

</providers>

</data>

 

<newdata defaultProvider="SqlDataProvider" >

<providers>

<clear/>

<add name = "SqlDataProvider"

type = "DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider"

connectionString = "Server=DatabaseServer;Database=DatabaseName;uid=sa;pwd=sa;"

providerPath = "~\Providers\DataProviders\SqlDataProvider\"

objectQualifier = ""

databaseOwner = "dbo" />

</providers>

</newdata>

 

...

</dotnetnuke>

 

Using the DAL method, you can then change the providerType in your modules sqldataprovider file.

 
New Post
12/8/2006 9:39 AM
 
The Instance method allows an XMLAttributeCollection object, so by passing the "name" and "type" parameters in an XMLAttibuteCollection you can probably use the DAL+ saving some typing.

Do you know the truth when you hear it?
Néstor Sánchez
The Dúnadan Raptor -->Follow Me on Twitter Now!
 
New Post
12/10/2006 1:56 PM
 

Thanks for the input hooligannes! I'm not familiar with this process, could you provide an example?

Thanks

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0DAL+ - extra database connectionDAL+ - extra database connection


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