Data Processing Extension using Microsoft.Practices.EnterpriseLibr ary.Data
Hi, I tried to create a data processing extensionand deploy the .dll as the DataSource ofreports and gotan error in the report wizard as follows:"An error occirred while the query design method was being saved. The requested databaseDBName is not defined in confguration."Following thestructure listed at http://msdn.microsoft.com/en-us/library/aa902651(SQL.80).aspxthis is how mydata processing extensionis created to retrieve the data:A Business Logic Layerobject iscalled in DataReader class to return DataSetwhilea Data Access Layer object is called inBusiness Logic Layerobject to connect to database.
Microsoft.Practices.EnterpriseLibrary has been used inData Access Layer object as follows:
Imports Microsoft.Practices......Protected m_db As EnterpriseLibrary.Data.Databasem_db = EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase("DBName")Dim l_dbCommand As System.Data.Common.DbCommandDim l_outData As DataSetl_dbCommand = m_db.GetStoredProcCommand("usp_StoredProcedureName")......l_outData = m_db.ExecuteDataSet(l_dbCommand)In our web applications, web.config file is usedto store connection string info forDBName.(whereEnterpriseLibrary gets the connection string from)Now, how can i make myData Access Layer object in data processing extension/deployed.dllrecognize the database connection string stored inweb.config. (Without changingData Access Layer object)Thanks for your help.Regards,Erhan
February 24th, 2009 11:26pm
Hey Erhan,
1. You just need to copy the web.config file which have connection string with the name 'DBName'. The Data Access Layer component will uses this connection string to create the connection.
2. Very importantly, we need to have the below mentioned configuration entries which are specific to Enterprise Library.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<!-- Enterprise Library -->
<section name="msDataConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Culture=neutral, PublicKeyToken=683f3cf0f006f04a"/>
</configSections>
<msDataConfiguration defaultDatabase="InventoryManagement">
<providerMappings>
<add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase, Microsoft.Practices.EnterpriseLibrary.Data, Culture=neutral, PublicKeyToken=683f3cf0f006f04a"
name="Oracle.DataAccess.Client" />
<add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase, Microsoft.Practices.EnterpriseLibrary.Data, Culture=neutral, PublicKeyToken=683f3cf0f006f04a"
name="System.Data.SqlClient" />
</providerMappings>
</msDataConfiguration>
<connectionStrings>
<add name="Log" connectionString="Data Source=XYZ;Initial Catalog=ABC;User ID=PQR;Password=XYZ$$786;" providerName="System.Data.SqlClient"/>
<add name="InventoryManagement" connectionString="Data Source=XYZ2;Initial Catalog=ABC;User ID=PQR;Password=XYZ$$786;" providerName="System.Data.SqlClient"/>
</connectionStrings>
-Mohammed Ghouse Ibne Barq Kadapavi
http://www.ProgrammersVision.blogspot.com
https://sites.google.com/site/BarqKadapavi
Please mark the post answered your question as the answer, and mark other helpful posts as helpful. Mohammed Ghouse Ibne Barq Kadapavi
Free Windows Admin Tool Kit Click here and download it now
May 16th, 2011 5:57am