i have this class library that connects to the database(see appconfig below)
compiling 0 errors but when its running i amhaving this error
An unhandled exception of type 'System.NullRef erenceException ' occurred in
my_deepot_commo n.dll Object reference not set to an instance of an obj
int this line
public System.Data.Sql Client.SqlConne ction user_connection = new
System.Data.Sql Client.SqlConne ction(System.Co nfiguration.Con figurationManag er.ConnectionSt rings["my_deepot_comm on.Properties.S ettings.utiliza doresConnection String"].ConnectionStri ng);
thanks
using System;
using System.Collecti ons.Generic;
using System.Text;
using System.Data;
using System.Data.Sql Client;
using System.Configur ation;
namespace my_deepot_commo n
{
public class DB_Connection
{
public System.Data.Sql Client.SqlConne ction user_connection = new
System.Data.Sql Client.SqlConne ction(System.Co nfiguration.Con figurationManag er.ConnectionSt rings["my_deepot_comm on.Properties.S ettings.utiliza doresConnection String"].ConnectionStri ng);
public System.Data.Sql Client.SqlConne ction lang_connection = new
System.Data.Sql Client.SqlConne ction(System.Co nfiguration.Con figurationManag er.ConnectionSt rings["my_deepot_comm on.Properties.S ettings.linguag emConnectionStr ing"].ConnectionStri ng);
public DB_Connection()
{
}
}
}
APP_CONFIG
<connectionStri ngs>
<add
name="my_deepot _common.Propert ies.Settings.li nguagemConnecti onString"
connectionStrin g="Data
Source=.\SQLEXP RESS;AttachDbFi lename=E:\my_de epot\my_deepot_ common\Data\lin guagem.mdf;Inte grated
Security=True;U ser Instance=True"
providerName="S ystem.Data.SqlC lient" />
<add
name="my_deepot _common.Propert ies.Settings.ut ilizadoresConne ctionString"
connectionStrin g="Data
Source=.\SQLEXP RESS;AttachDbFi lename=E:\my_de epot\my_deepot_ common\Data\uti lizadores.mdf;I ntegrated
Security=True;U ser Instance=True"
providerName="S ystem.Data.SqlC lient" />
</connectionStrin gs>