I tried to get appsetting from app config in my winform application (just a small project for study) but when i run my project, vs2013 throws an exception named "NullReferenceException"
Although i have read this topic : how to get connection string from app config in c# And my code now is :
SqlConnection bookcon = new SqlConnection(ConfigurationManager.AppSettings["MyConnection"].ToString());
Im still receive the same exception, please tell me how to solve this problem? This is my appconfig file :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="MyConnection" value="Data Source=HUYMANIT\\SQLEXPRESS;Initial Catalog=QLTV_1312240;Persist Security Info=True;User ID=sa;Password=123456"/>
</appSettings>
</configuration>