Hello,
im using Enterpride Library here. im not doing in the smartclient solution.
im getting the following exception for the database factory...
Object reference not set to an instance of an object.
this is the code in DAL...
Code Snippet
namespace
DAL
{
public class Class1
{
Database _objDB;
DbCommand _objCmd;
string strProc = string.Empty;
DataSet ds = new DataSet();
public Class1()
{
_objDB =
DatabaseFactory.CreateDatabase(); ---> here is the exception
}
public DataSet GetValues()
{
strProc =
ConfigurationManager.AppSettings["EmpDetails"].ToString();
SqlParameter param = new SqlParameter("@EmpNo", SqlDbType.Int);
_objCmd = _objDB.GetStoredProcCommand(strProc, param);
ds = _objDB.ExecuteDataSet(_objCmd);
return ds;
}
}
}
and this is the code which i wrote in the app.config.
Code Snippet
<?
xml version="1.0" encoding="utf-8" ?>
<
configuration>
<
configSections>
<
section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</
configSections>
<
dataConfiguration defaultDatabase="Connection String">
<
providerMappings>
<
add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase, Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="System.Data.SqlClient" />
</
providerMappings>
</
dataConfiguration>
<
connectionStrings>
<
add name="Connection String" connectionString="Data Source=YH964;Initial Catalog=Shailu;Integrated Security=True"
providerName="System.Data.SqlClient" />
</
connectionStrings>
</
configuration>
am i missing anything more...?
Please help me.