Last post Dec 21, 2005 10:32 AM by Konk
Dec 17, 2005 07:34 AM|NDLanding|LINK
I want to change the connection string of my custom module data provider from the default DotNetNuke connection string. Please could someone tell me how I might go about doing this? I have followed the typical module architecture i.e. I have a DataProvider
class, SqlDataProvide class. In the SqlDataProvider class I see the following
Public Sub New()
Dim objProvider as Provider = Ctype(.....etc.
Is it somewhere here where I make the changes?
Dec 19, 2005 03:41 PM|Konk|LINK
are u saying that your module targets another database? i.e. not the default database that dotnetnuke uses? if so, you need to add an entry in the web.config file with the connection string to your db. and you would need to make a change in your module sqlprovider
to use that setting instead of the default.
Dec 21, 2005 04:15 AM|NDLanding|LINK
Thanks for the reply. Yes, my module targets another database. I included a key and value in the web config and altered the sqldataprovider
Dec 21, 2005 10:32 AM|Konk|LINK
There are two sections in web.config that need to be changed. Duplicate both those sections and modify to match your second database. Although keep in mind that if you are going to use a third party hosting site, you will have to pay for an additonal database.
1. Add your database key here
<add key="SiteSqlServer" value="Server=servername;Database=DotNetNuke;uid=sa;pwd=password;" />
2. Create another entry just like this. Change "data" to "mydata" and "SiteSqlServer" to whatever you used in 1. Then in you SQLdataprovider class, refer to mydata to target your database.
<add name="SqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider" connectionStringName="SiteSqlServer" upgradeConnectionString="" providerPath="~\Providers\DataProviders\SqlDataProvider\" objectQualifier=""
Let the community know if that worked for you.