2014年11月23日 星期日

各版本的Sql connection 字串寫法

LocalDB:
<add name="ConnectionStringName" providerName="System.Data.SqlClient"  
connectionString="Data Source=(LocalDB)\v11.0;AttachDbFileName=|DataDirectory|\DatabaseFileName.mdf;InitialCatalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True" />

Sql Express:
<add name="ConnectionStringName" providerName="System.Data.SqlClient"
    connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True"/>
Sql Server:
<add name="ConnectionStringName" providerName="System.Data.SqlClient"
    connectionString="Data Source=ServerName;Initial Catalog=DatabaseName;Integrated Security=False;User Id=userid;Password=password;MultipleActiveResultSets=True" />                        

SQL Azure:
<add name="ConnectionStringName"  providerName="System.Data.SqlClient"
    connectionString="Data Source=tcp:ServerName.database.windows.net,1433;Initial Catalog=DatabaseName;Integrated Security=False;User Id=username@servername;Password=password;Encrypt=True;TrustServerCertificate=False;MultipleActiveResultSets=True" />

Entity Framework Database:
<add name="ConnectionStringName"  providerName="System.Data.EntityClient"
    connectionString="metadata=res://*/ ContextClass.csdl|res://*/ ContextClass.ssdl|res://*/ ContextClass.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ServerName;Integrated Security=False;User Id=userid;Password=password;MultipleActiveResultSets=True&quot;" />

Sql Compact:
<add name="ConnectionStringName" providerName="System.Data.SqlServerCe.4.0"
    connectionString="Data Source=|DataDirectory|\DatabaseFileName.sdf" />

1 則留言:

  1. Casino Bonus Codes - December 2021
    No deposit bonus casino promotions. We recommend https://deccasino.com/review/merit-casino/ 2021 casino bonus codes and promos for new players. We also list apr casino new https://vannienailor4166blog.blogspot.com/ casino 바카라 사이트 bonuses for December poormansguidetocasinogambling.com 2021.

    回覆刪除

熱門文章