Hi everybody .
I was coding a module what to connect another database by adding provider in web.config .
But It was happened any error . Note : I dont want connect to another database by creating connectString and query directly .
Example :
private ProviderConfiguration _providerConfiguration = ProviderConfiguration.GetProviderConfiguration(ProviderType);
Provider objProvider = (Provider)_providerConfiguration.Providers[_providerConfiguration.DefaultProvider];
_connectionString = Config.GetConnectionString("MyConnectString");
with this code , it is all right . No problem .
But I really want using provider to connect to another database using Dotnetnuke code .
In web.config , i add provider as :
<section name="secondsqldata" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" />
<add name="secondSqlServer" connectionString="Data Source=PKNGUYEN\SQLEXPRESS;Initial Catalog=DatabaseMoi;User ID=sa;Password=123" providerName="System.Data.SqlClient" />
<add key="secondSqlServer" value="Data Source=PKNGUYEN\SQLEXPRESS;Initial Catalog=DatabaseMoi;User ID=sa;Password=123;" />
<secondsqldata defaultProvider="SecondSqlDataProvider">
<providers>
<clear />
<add name="SecondSqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider" connectionStringName="secondSqlServer" upgradeConnectionString="" providerPath="~\Providers\DataProviders\SqlDataProvider\" objectQualifier="" databaseOwner="dbo" />
</providers>
</secondsqldata >
But it is not running .
Help me pls .
Thanks for all.