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