Accessing database connection string using app.config in C# winform

前端 未结 10 1179
遇见更好的自我
遇见更好的自我 2020-12-06 00:27

I can\'t seem to be able to access the app.config database connection string in my c# winforms app.

app.config code

   
           


        
10条回答
  •  情歌与酒
    2020-12-06 00:32

    This is all you need:

    System.Configuration.ConfigurationManager.ConnectionStrings["MyDBConnectionString"].ConnectionString;
    

提交回复
热议问题