web.config 資料庫連線字串(對象MSSQL2005)

摘要:web.config 資料庫連線字串(對象MSSQL2005)

<connectionStrings>
  <add name="Green123"

connectionString=

"Data Source=localhost;

Initial Catalog=資料庫名稱;

User Id=帳號;

Password=密碼;

Max Pool Size = 1024;" providerName="System.Data.SqlClient"/>
 </connectionStrings>

providerName 設定如下

 

實體資料庫連線

  <add name="JobDBConnectionString" connectionString="DataSource=.\SQLEXPRESS;

AttachDbFilename=|DataDirectory|\JobDB.mdf;

Integrated Security=True;

Connect Timeout=30;User Instance=True"
 providerName="System.Data.SqlClient" />

|DataDirectory| 來代表App_Data