What you need are a couple of additions to web.config as shown here and then change a couple of lines in SqlDataProvider.vb and DataProvider.vb of your module.
I have tried to colour code the matching entries for you:
<configSections>
<sectionGroup name="dotnetnuke">
<!-- the requirePermission attribute will cause a syntax warning - please ignore - it is required for Medium Trust support-->
<section name="data" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/>
You add your setting here:
<section name="MyData" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/>
<connectionStrings>
<!-- Connection String for SQL Server 2000/2005 -->
<add name="SiteSqlServer" connectionString="Server=(local);Database=DotNetNuke_2dev;uid=XX_sa;pwd=XX;" providerName="System.Data.SqlClient"/>
You add your setting here:
<add name=" MyDataSiteSqlServer" connectionString="Server=(local);Database=MyDatabase;uid=My_sa;pwd=MyPassword;" providerName="System.Data.SqlClient"/> </connectionStrings>
<appSettings>
<!-- Connection String for SQL Server 2000/2005 - kept for backwards compatability - legacy modules -->
<add key="SiteSqlServer" value="Server=(local);Database=DotNetNuke_2dev;uid=Mysa;pwd=XX;"/>
You add your setting here:
<add key=" MyDataSiteSqlServer " value="Server=(local);Database=MyDatabase;uid=My_sa;pwd= MyPassword;"/>
Add the following just below the default
<data defaultProvider ---
</data>
<MyData defaultProvider="SqlDataProvider">
<providers>
<clear/>
<add name="SqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider"
connectionStringName=" MyDataSiteSqlServer"
upgradeConnectionString=""
providerPath="~\Providers\DataProviders\SqlDataProvider\"
objectQualifier=""
databaseOwner="dbo"/>
</providers>
</ MyData>
Now to your module:
Change the line below in SqlDataProvider.vb to point to your MyData
It follows:
Inherits DataProvider
#Region "Private Members"
Private Const ProviderType As String = "MyData"
In DataProvider.vb change the objProvider line below to MyData:
Private Shared Sub CreateProvider()
objProvider = CType(Framework.Reflection.CreateObject("MyData", "Stored Proc name here", ""), DataProvider)
Declan