Config ConnectionStrings
<connectionStrings>
<add name ="MyschoolConnectionString" connectionString ="Data Source =.;Initial Catalog = MySchool1;uid = sa;pwd = 123456"/>
</connectionStrings>
string connstr = ConfigurationManager.ConnectionStrings["MyschoolConnectionString"].ConnectionString;
引入configuartion