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

前端 未结 10 1176
遇见更好的自我
遇见更好的自我 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:37

    You are using the ConnectionStrings collection, not the AppSettings.

    ConfigurationManager.ConnectionStrings["MyDbConnectionString"].ConnectionString;
    

提交回复
热议问题