我编写了一个简单的wpf应用程序来绑定datagrid中的数据。它在下一行运行时抛出错误。
string ConString = System.Configuration.ConfigurationManager
.ConnectionStrings["ConString"].ToString();
异常显示:Exception has been thrown by the target of an invocation."
InnerException:{"Object reference not set to an instance of an object."}
答案 0 :(得分:1)
可能System.Configuration.ConfigurationManager.ConnectionStrings [“ConString”]为NULL或 System.Configuration.ConfigurationManager.ConnectionStrings为NULL。