//读取连接字符串 string conn =System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; //读取appsetting配置 string GrpCode = ConfigurationManager.AppSettings["DepartmentAttrCode"].ToString();
主要使用了ConfigurationManager类。需要引用System.Configuration