Hero is coming back

风吹呀吹

风会指引你前进的方向

C# Connection To SQL

 //添加引用
 using System.Data.SqlClient;

 string connection = System.Configuration.ConfigurationManager.ConnectionStrings["AlexConnection"].ConnectionString;

 //web.config
  <connectionStrings>
    <add name="AlexConnection" connectionString="Server=.;Database=alex;Trusted_Connection=true" providerName="System.Data.SqlClient" />
  </connectionStrings>

 

posted @ 2017-11-29 07:15  风吹呀吹  阅读(132)  评论(0编辑  收藏  举报