473,583 Members | 2,875 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

An unhandled exception of type 'System.NullRef erenceException ' occurred in my_deepot_commo n.dll

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>

Dec 21 '07 #1
1 3157
the connection string was malformed

public System.Data.Sql Client.SqlConne ction user_connection = new
System.Data.Sql Client.SqlConne ction("Data
Source=.\\SQLEX PRESS;AttachDbF ilename=E:\\my_ deepot\\comum\\ Data\\utilizado res.mdf;Integra ted
Security=True;U ser Instance=True") ;
public System.Data.Sql Client.SqlConne ction lang_connection = new
System.Data.Sql Client.SqlConne ction("Data
Source=.\\SQLEX PRESS;AttachDbF ilename=E:\\my_ deepot\\comum\\ Data\\linguagem .mdf;Integrated
Security=True;U ser Instance=True") ;

//public System.Data.Sql Client.SqlConne ction user_connection = new
System.Data.Sql Client.SqlConne ction(System.Co nfiguration.Con figurationManag er.ConnectionSt rings["comum.Properti es.Settings.uti lizadoresConnec tionString"].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["comum.Properti es.Settings.lin guagemConnectio nString"].ConnectionStri ng);
"Pedro Dinis" <pe***@code4cer veja.comescreve u na mensagem
news:D1******** *************** ***********@mic rosoft.com...
>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>
Dec 21 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
536
by: Rafael | last post by:
Hi, I hope I can find some help for this problem IDE: Visual Studio.NET 2003 Developer Editio Language: C# Problem: "An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll. Additional information: Object reference not set to an instance of an object. Visual Studio's IDE is not allowing me to...
0
1659
by: Rafiq Ganaie via .NET 247 | last post by:
HI, I am working on a search application in C#.It is a multithreaded application.it simply takes a URL,Downloads the page using WebRequest and WebResponse classes.Unfortunately it is throwing following runtime exception. An unhandled exception of type 'System.NullReferenceException' occurred in system.dll Additional information: Object...
3
2941
by: Professor Frink | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms application that is going to be used to extract data from a legacy system (VSAM based mainframe file structure), and output data in pipe-delimited...
3
2448
by: cristiank | last post by:
hi everybody, I need to clear something out, does anybody have ever encountered such an exception until now : "Un unhandled exception of type System.NullReferenceException occurred in system.windows.forms.dll Additional information: Object reference not set to an instance of an object." I receive this exception when I use HelpProvider and...
3
16920
by: juli | last post by:
Hello! I keep getting this error: An unhandled exception of type 'System.NullReferenceException' occurred Additional information: Object reference not set to an instance of an object. I am declaring with this code(class member): private Steema.TeeChart.Styles.Series ASeries; and than trying to initialize it:
4
2240
by: Craig831 | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms application that is going to be used to extract data from a legacy system (VSAM based mainframe file structure), and output data in pipe-delimited...
7
2669
by: Chuck Hartman | last post by:
I have a Windows service that requests web pages from a site using an HttpWebRequest object. When I try to request a page from an ASP.NET 2 site, I get a WebException with message "The remote server returned an error: (500) Internal Server Error." I found a post that suggested to catch the WebException to retrieve the actual HttpWebResponse...
1
2097
by: mike | last post by:
My program is crashing, but it doesn't crash on a single line of code. Below is what the output tab displays. I have no idea where to start inorder to debug this problem. Is there any suggesstions on how to start debuging the problem 'DefaultDomain': Loaded 'c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols loaded...
9
3165
by: Supra | last post by:
i got error problem.......... An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll Additional information: Object reference not set to an instance of an object.. Namespace PirateChat <========== error occurred in here Public Class mainPirateChat
0
7896
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7828
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8186
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8329
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7936
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
3821
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3847
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1436
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1160
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.