给你我写的先配置数据连接 要用的话就这样写con=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["con"]);其实就是key value结构