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 NairPosted Nov 19, 2013, 4:47 AM
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
Prasenjit DeyPosted Nov 18, 2013, 6:05 AM
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.
Maneesh A NPosted Nov 18, 2013, 6:00 AM
Maneesh A NPosted Nov 18, 2013, 5:58 AM
Maneesh A NPosted Nov 18, 2013, 5:56 AM
Prasenjit DeyPosted Nov 18, 2013, 4:17 AM
{
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
Posted Nov 18, 2013, 4:13 AM
make sure the connection name 'sqlconnection' is available in your .config file.
Suthish NairPosted Nov 18, 2013, 4:12 AM
http://stopdebugging.wordpress.com/2013/11/06/error-object-reference-not-set-to-an-instance-of-an-object/