Actually, I was looking for a way to do it without hard-coding the connection strings, and - thanks to a night of insomnia - I figured it out:
(1) In your SqlDataProvider.vb module's constructor, change "_providerConfiguration.DefaultProvider" to, for example "custom":
'Dim objProvider As Framework.Providers.Provider = CType(_providerConfiguration.Providers(_providerConfiguration.DefaultProvider), Framework.Providers.Provider)
Dim objProvider As Framework.Providers.Provider = CType(_providerConfiguration.Providers("custom"), Framework.Providers.Provider)
(2) In web.config, add another provider (called "custom") to the DotNetNuke\data config section:
<data defaultProvider="SqlDataProvider">
<providers>
<clear/>
<add name="SqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider" connectionStringName="SiteSqlServer" upgradeConnectionString="" providerPath="~\Providers\DataProviders\SqlDataProvider\" objectQualifier="" databaseOwner="dbo"/>
<add name="custom"
type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider"
connectionString="Data Source=servername;Database=databasename;Integrated Security=True"
upgradeConnectionString="" providerPath="~\Providers\DataProviders\SqlDataProvider\"
objectQualifier=""
databaseOwner="dbo"/>
</providers>
</data>
You can also use connectionStringName="customConnectionString" instead of connectionString="...", but you’ll have to add a connection string to the <appSettings> section of web.config:
<appSettings>
<add name="customConnectionString"
connectionString="Server=servername;Database=databasename;Integrated Security=True;"
providerName="System.Data.SqlClient"/>
</appSettings>