Hi there,
I have been developing our companies intranet portal using DotNetNuke 3.0.
All the custom modules I have implemented work fine when using the standard default SqlDataProvider for DotNetNuke.
However I need my modules to store and retrieve data from a second seperate Sql Database.
I have tried the following, however have had no luck:
web.config (added lines only)
------------
<sectionGroup name="dotnetnuke">
<section name="Guardiandata" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" />
</sectionGroup>
<appSettings>
<add key="GuardianSiteSqlServer" value="Server=(local);Database=TestData;uid=myuserID;pwd=myUserPassword;" />
</appSettings>
<guardiandata defaultProvider="GuardianSqlDataProvider">
<providers>
<clear />
<add name="GuardianSqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider" connectionStringName="GuardianSiteSqlServer" upgradeConnectionString="" providerPath="~\Providers\DataProviders\SqlDataProvider\" objectQualifier="" databaseOwner="dbo" />
</providers>
</guardiandata>
SqlDataProvider.vb (added lines only)
----------------------
#Region "Private Members"
Private Const ProviderType As String = "Guardiandata"
Private _providerConfiguration As Framework.Providers.ProviderConfiguration = Framework.Providers.ProviderConfiguration.GetProviderConfiguration(ProviderType)
Private _connectionString As String
Private _providerPath As String
Private _objectQualifier As String
Private _databaseOwner As String
#End Region
When I try perform a database operation with my custom module it throws the following exception:
DotNetNuke.Services.Exceptions.ModuleLoadException: The type initializer for "Horsetorque.DNN.Modules.ProductManager.Data.DataProvider" threw an exception. ---> System.TypeInitializationException: The type initializer for "Horsetorque.DNN.Modules.ProductManager.Data.DataProvider" threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Key cannot be null. Parameter name: key at System.Collections.Hashtable.get_Item(Object key) at Horsetorque.DNN.Modules.ProductManager.Data.SqlDataProvider..ctor() in C:\Dotnetnuke\DesktopModules\ProductManager\Providers\SqlDataProvider\SqlDataProvider.vb:line 26 --- End of inner exception stack trace --- at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at DotNetNuke.Framework.Reflection.CreateObject(String TypeName, String CacheKey) at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectProviderName, String ObjectNamespace, String ObjectAssemblyName) at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectNamespace, String ObjectAssemblyName) at Horsetorque.DNN.Modules.ProductManager.Data.DataProvider.CreateProvider() in C:\Dotnetnuke\DesktopModules\ProductManager\Components\DataProvider.vb:line 20 at Horsetorque.DNN.Modules.ProductManager.Data.DataProvider..cctor() in C:\Dotnetnuke\DesktopModules\ProductManager\Components\DataProvider.vb:line 15 --- End of inner exception stack trace --- at Horsetorque.DNN.Modules.ProductManager.Data.DataProvider.Instance() at Horsetorque.DNN.Modules.ProductManager.Business.CustomerCareRegistrationClientsController.AddCustomerCareRegistrationClients(CustomerCareRegistrationClientsInfo objCustomerCareRegistrationClients) in C:\Dotnetnuke\DesktopModules\ProductManager\Components\ProductManagerController.vb:line 22 at Horsetorque.DNN.Modules.ProductManager.ProductManagerEdit.cmdUpdate_Click(Object sender, EventArgs e) in C:\Dotnetnuke\DesktopModules\ProductManager\ProductManagerEdit.ascx.vb:line 238 --- End of inner exception stack trace ---
When I change the SqlDataProvider.vb ProviderType back to "data" the error does not occur, however the module will not work because the stored procedures do not exist in the default DotNetNuke database.
Is there a section I am not adding in the web.config?
Thanks in advance