Click here to Skip to main content
15,902,865 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I can add the my coding in below

C#
35         //this.Con = new SqlConnection(s);
36         //this.Con.Open();
37         string ss = ConfigurationManager.ConnectionStrings["Con"].ToString();
38         this.Con = new SqlConnection(ss);
39         this.Con.Open();


object reference not set to an instance of an object error comes in internet explorer window ,,

how to solve these error ASAP............
Posted
Updated 25-Feb-11 3:24am
v3

You have not added any connection string with name "Con" in your web.config
Use the following code

string ss = ConfigurationManager.ConnectionStrings["Con"].ConnectionString;
this.Con = new SqlConnection(ss);
this.Con.Open();
 
Share this answer
 
There is an object somewhere in your code that has not been instantiated and is null.
You are probably trying to access a property in that object and that is why you are getting this error!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900