Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > Exception -- Object reference not set to an instance of an object.
 

Exception -- Object reference not set to an instance of an object.

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.

Shailu123  Wednesday, May 21, 2008 10:07 AM

Hi,

This question is about Enterprise Library and not GAX. Please post it to the EntLib forums here:

http://www.codeplex.com/entlib

EntLib team members hang around that forum and should be able to help you.

-vga.

vga  Monday, May 26, 2008 6:07 AM

Hi,

This question is about Enterprise Library and not GAX. Please post it to the EntLib forums here:

http://www.codeplex.com/entlib

EntLib team members hang around that forum and should be able to help you.

-vga.

vga  Monday, May 26, 2008 6:07 AM

You can use google to search for other answers

Custom Search

More Threads

• Web Project
• Help! Recipe Framework Error - Register Recipe "EnvDTE.Project, EnvDTE"
• Copy WSSF and use as base for new GA package (formerly Where are the configuration files located?)
• Can't open the guidance navigator window
• Passing argument between wizards (with custom TypeConverters)
• How to generate code for a method in an existing class using T4 Template
• GAX installed but not showing in VS 2008
• Uninstall Failure
• ProjectReference
• June GAT Installation Issues