Static member initialization exception this is the connection to the database

private static string connStr = ConfigurationManager.ConnectionStrings ["data"] .ConnectionString;

what does that mean? I don"t understand. I"m going to connect to the database and winform

. What is

["data"]

copy it from a blogger.

Mar.22,2021

private static string connStr =ConfigurationManager.ConnectionStrings["data"].ConnectionString;

this is the string that links the database

["data"] to connect ConnectionStrings ["data"] look at it this way

get the data named data field


this is the connection string in app.config. App.config has multiple connection strings. This data means to find the connection string whose key is "data".

Menu