Shipu
Shipu

Reputation: 563

Exception has been thrown by the target of an invocation in wpf application

I have written a simple wpf application for binding data in datagrid. It throws error while running at following line.

string ConString = System.Configuration.ConfigurationManager
                         .ConnectionStrings["ConString"].ToString();

Exception shows: Exception has been thrown by the target of an invocation."

InnerException:{"Object reference not set to an instance of an object."}

Upvotes: 1

Views: 3301

Answers (1)

Michel Keijzers
Michel Keijzers

Reputation: 15367

Probably System.Configuration.ConfigurationManager.ConnectionStrings["ConString"] is NULL or System.Configuration.ConfigurationManager.ConnectionStrings is NULL.

Upvotes: 1

Related Questions