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
1/18/2007 10:06 PM
 

Michael - can you give me a clue what the solution is it would be nice to wrap up that little part of this old project so it can be used

you could send code if you have it to my email -dylan.barer@earthlink.net


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
1/18/2007 10:28 PM
 

I haven't started work on this and I don't think I'll get to it for another 3 weeks, but my plan was to simply overload the DAL+ methods in the SqlDataProvider.vb like this:

 Public Overrides Function ExecuteReader(ByVal ProcedureName As String, ByVal ParamArray commandParameters() As Object) As IDataReader

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

End
Function

to allow you to pass the ConnectionString (and probably all the other parameters). You can get this value from the web.config or pass it explicitly. When I do this I'll make a blog post and post source code on my site.  If anyone else gets to it before I do please share :)

 



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
1/19/2007 1:03 PM
 

so this would just be a dll you could load and then call the function

something like:

reader = dylan.dnn.modules.overridedall.executereader("connectionstring","storedproc","params")


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
1/19/2007 1:14 PM
 

Michael - this is what i have so far and it doesnt work for me but maybe you can see where it whent wrong

i was trying to do this

     Using dr As IDataReader = Codegalaxy.DNN.OverrideDAL.Override.Instance().ExecuteReader("SiteSqlServer2", "TANKS_ANALYSIS_General", 1)

what i would really like is for it to look like this

     Using dr As IDataReader = DotNetNuke.Data.DataProvider.Instance("SiteSqlServer2").ExecuteReader("TANKS_ANALYSIS_General", 1)

but that seems to be beyong my abilities

 

Imports System
Imports System.Configuration
Imports System.Data
Imports System.XML
Imports System.Web
Imports System.Collections.Generic

Imports DotNetNuke
Imports DotNetNuke.Common
Imports DotNetNuke.Common.Utilities.XmlUtils
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Services.Search
Imports Microsoft.ApplicationBlocks.Data

Namespace Codegalaxy.DNN.OverrideDAL
    Public MustInherit Class Override
        Inherits DotNetNuke.Data.DataProvider

#Region "Private Members"
        Private Const ProviderType As String = "data"

        Private _providerConfiguration As DotNetNuke.Framework.Providers.ProviderConfiguration = DotNetNuke.Framework.Providers.ProviderConfiguration.GetProviderConfiguration(ProviderType)
        Private _connectionString As String
        Private _providerPath As String
        Private _objectQualifier As String
        Private _databaseOwner As String
        Private _upgradeConnectionString As String
#End Region

#Region "Constructors"

      

        Public Sub New()

            _providerConfiguration = DotNetNuke.Framework.Providers.ProviderConfiguration.GetProviderConfiguration(ProviderType)
            ' Read the configuration specific information for this provider
            Dim objProvider As DotNetNuke.Framework.Providers.Provider = CType(_providerConfiguration.Providers(_providerConfiguration.DefaultProvider), DotNetNuke.Framework.Providers.Provider)

            ' Read the attributes for this provider

            'Get Connection string from web.config
            _connectionString = Config.GetConnectionString()

            If _connectionString = "" Then
                ' Use connection string specified in provider
                _connectionString = objProvider.Attributes("connectionString")
            End If

            _providerPath = objProvider.Attributes("providerPath")

            _objectQualifier = objProvider.Attributes("objectQualifier")
            If _objectQualifier <> "" And _objectQualifier.EndsWith("_") = False Then
                _objectQualifier += "_"
            End If

            _databaseOwner = objProvider.Attributes("databaseOwner")
            If _databaseOwner <> "" And _databaseOwner.EndsWith(".") = False Then
                _databaseOwner += "."
            End If

            If Convert.ToString(objProvider.Attributes("upgradeConnectionString")) <> "" Then
                _upgradeConnectionString = objProvider.Attributes("upgradeConnectionString")
            Else
                _upgradeConnectionString = _connectionString
            End If

        End Sub

#End Region

#Region "Public Properties"
        Public ReadOnly Property ConnectionString() As String
            Get
                Return _connectionString
            End Get
        End Property

        Public ReadOnly Property ProviderPath() As String
            Get
                Return _providerPath
            End Get
        End Property

        Public ReadOnly Property ObjectQualifier() As String
            Get
                Return _objectQualifier
            End Get
        End Property

        Public ReadOnly Property DatabaseOwner() As String
            Get
                Return _databaseOwner
            End Get
        End Property

        Public ReadOnly Property UpgradeConnectionString() As String
            Get
                Return _upgradeConnectionString
            End Get
        End Property

#End Region

 

        Public Overloads Function ExecuteReader(ByVal ConnectionString As String, ByVal ProcedureName As String, ByVal ParamArray commandParameters() As Object) As IDataReader
            _connectionString = Config.GetConnectionString(ConnectionString)
            Return SqlHelper.ExecuteReader(_connectionString, DatabaseOwner & ObjectQualifier & ProcedureName, commandParameters)

        End Function


        Public Overloads Sub ExecuteNonQuery(ByVal ConnectionString As String, ByVal ProcedureName As String, ByVal ParamArray commandParameters() As Object)
            _connectionString = Config.GetConnectionString(ConnectionString)
            SqlHelper.ExecuteNonQuery(_connectionString, DatabaseOwner & ObjectQualifier & ProcedureName, commandParameters)
        End Sub
      

        Public Overloads Function ExecuteScalar(ByVal ConnectionString As String, ByVal ProcedureName As String, ByVal ParamArray commandParameters() As Object) As Object
            _connectionString = Config.GetConnectionString(ConnectionString)
            Return SqlHelper.ExecuteScalar(_connectionString, DatabaseOwner & ObjectQualifier & ProcedureName, commandParameters)
        End Function
    End Class

End Namespace


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
1/19/2007 8:36 PM
 

You efforts have already saved me some work. I think I will simply call "SqlHelper" directly. From my work on the DAL Project I learned that it is simply a call of "Microsoft.ApplicationBlocks.Data.dll". So there should be no need to go through the Core's "SqlDataProvider.vb" to get it to do what we want.

Now the proposed changes to the Core would go in "SqlDataProvider.vb" so that you could call it like:

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

I hopefully will get to this in the next few weeks and Blog about it.



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
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