public ClsConnect()
{
strConnect = ConfigurationManager.ConnectionStrings["sqlConnection"].ConnectionString;
conSql = new SqlConnection(strConnect);
}
here i got error ....Object reference not set to an instance of an object.
Loading

Suthish NairRank #92 · 22.8K reputationPosted Nov 17, 2013, 11:12 PM EST
http://stopdebugging.wordpress.com/2013/11/06/error-object-reference-not-set-to-an-instance-of-an-object/
Posted Nov 17, 2013, 11:13 PM EST
make sure the connection name 'sqlconnection' is available in your .config file.
Prasenjit DeyRank #6,279 · 271 reputationPosted Nov 17, 2013, 11:17 PM EST
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["sqlConnection"].ToString());
}
use that code. And must be check that "sqlConnection" is declare perfectly in ConnectionString in your web.config file
Maneesh A N179 reputationPosted Nov 18, 2013, 12:56 AM EST
Maneesh A N179 reputationPosted Nov 18, 2013, 12:58 AM EST
Maneesh A N179 reputationPosted Nov 18, 2013, 1:00 AM EST
Prasenjit DeyRank #6,279 · 271 reputationPosted Nov 18, 2013, 1:05 AM EST
have you give a proper server name there means in ConnectionString in web.config. You have given that "server =.". Is it right? At least write there "server = localhost" if you are using local database or give the database IP address
(like server = " 192.168.1.563 ") if you are using a remote database server.
Suthish NairRank #92 · 22.8K reputationPosted Nov 18, 2013, 11:47 PM EST
If you want to learn, avoid spoon feeding. Why don't just dive into the code, debug each line of code and check why the code is failing.
How to: Generate or find Connection String from Visual Studio
error-object-reference-not-set-to-an-instance-of-an-object