Skip to content
Advertisement

How can I connect C# with Db with App.config?

I need to connect C# with SQL Server database using app.config.

My code is:

and in app.config I have:

but I get an error and I can’t fix it:

ConfigurationErrorExeption was Unhandled Configuration system failed to initialize

Can anyone help me please ?

Advertisement

Answer

Try:

You’re referencing Conn as the connection string name but referenced it as Test1 in the App.Config

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement