在DAl层中添加一下引用:


添加引用:
using System.Web.Configuration;
web.config中连接数据库的字符串:

获得web.config中连接数据库的字符串:
private static readonly string MySqlConnectionString = WebConfigurationManager.ConnectionStrings[“mysqlconnstring”].ToString();