在web.config中添加连接字符串并在数据访问层中访问它之后,它将引发异常 用户代码未处理typeinitialization异常
<connectionStrings>
<add name="BO"
connectionString="Data Source=DESKTOP-921J2S6\\SQLEXPRESS;Initial Catalog=CRUD;User ID=sa;Password=password-1;Integrated Security=False"
providerName="System.Data.SqlClient" />
</connectionStrings>
static string databaseConnection = ConfigurationManager.ConnectionStrings["BO"].ConnectionString;
SqlConnection con = new SqlConnection(databaseConnection);