Nullreference exception was unhandled
I am creating a microsoft WPF project and ran into the following hindrance:
Null re开发者_如何学JAVAference was unhandled Object reference not set to an instance of an object
My VS 2010 points to the following line of code:
string connectionString = ConfigurationManager.ConnectionStrings["Lab06Wpf.Properties.Settings.AppConnectionString"].ConnectionString;
Not sure why this is happening, I have a similar project where I have a similar connection string and it runs itself just fine.
The ConnectionStrings argument Lab06Wpf.Properties.Settings.AppConnectionString
is valid and the connection has been tested.
Any leads anyone?
ConfigurationManager.ConnectionStrings["Lab06Wpf.Properties.Settings.AppConnectionString"]
That is returning null and your are calling ConnectionString
on it. You need to find out why it is returning null. Use your debugger to see what ConnectionStrings
contains and why your call is failing.
精彩评论