473,545 Members | 2,009 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 3153
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
1649
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
2937
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
2444
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
16914
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
2235
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
2664
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
2086
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
3161
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
7475
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
7664
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. ...
1
7437
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
7771
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4958
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
720
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.