一、配置数据库连接字符串 <connectionStrings> <add name="CaoLPractise" connectionString="server=.;uid=sa;pwd=123456;database=CaoL.TJ.TreeShow"/> </connectionStrings> string conString = ConfigurationManager.ConnectionStrings["CaoLPractise"].ConnectionString;