[轉]SQLServer2005連結字串
資料來自:http://www.mozlite.com/Article/sqlserver2005.aspx
以下列出的是SqlServer2005在程式設計過程中的連結字串,可用於C++,VC++,ASP,PHP,.NET等等語言中。
SQL Native Client ODBC Driver
Standard Security
- Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Trusted Connection
- Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;
Connecting to a SQL Server Instance
- Driver={SQL Native Client};Server=myServerName heInstanceName;Database=myDataBase;Trusted_Connection=yes;
Prompt UserName and Password
- oConn.Properties(“Prompt”) = adPromptAlways
- Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;
Enabling MARS(multiple active results sets)
- Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;MARS_Connection=yes;
Encrypt data sent over network
- Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;Encrypt=yes;
Attach a database file on connect to a local SQL Server Express Instance
- Driver={SQL Native Client};Server=.SQLExpress;AttachDbFilename=c:asdqwemydbfile.mdf; Database=dbname;Trusted_Connection=Yes;
Attach a database file, located in the data directory, on connect to a local SQL Server Express Instance
- Driver={SQL Native Client};Server=.SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf; Database=dbname;Trusted_Connection=Yes;
Database Mirroring
- Data Source=myServerAddress;Failover Partner=myMirrorServer;Initial Catalog=myDataBase;Integrated Security=True;
SQL Native Client OLE DB Provider
Standard Security
- Provider=SQLNCLI;Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Trusted Connection
- Provider=SQLNCLI;Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;
Connecting to a SQL Server Instance
- Provider=SQLNCLI;Server=myServerName heInstanceName;Database=myDataBase;Trusted_Connection=yes;
Prompt for username and password
- oConn.Properties(“Prompt”) = adPromptAlways
- oConn.Open “Provider=SQLNCLI;Server=myServerAddress;DataBase=myDataBase;
Enabling MARS(multiple active results sets)
- Provider=SQLNCLI;Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;MarsConn=yes;
Encrypt data sent over network
- Provider=SQLNCLI;Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;Encrypt=yes;
Attach a database file on connect to a local SQL Server Express Instance
- Provider=SQLNCLI;Server=.SQLExpress;AttachDbFilename=c:asdqwemydbfile.mdf; Database=dbname;Trusted_Connection=Yes;
Attach a database file,located in the data directory,on connect to a local SQL Server Express Instance
- Provider=SQLNCLI;Server=.SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf; Database=dbname;Trusted_Connection=Yes;
Database Mirroring
- Data Source=myServerAddress;Failover Partner=myMirrorServer;Initial Catalog=myDataBase;Integrated Security=True;
SqlConnection (.NET)
Standard Security
- Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Standard Security alternative syntax
- Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;
Trusted Connection
- Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
Trusted Connection alternative syntax
- Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
Connect to a SQL Server Instance
- Server=myServerName heInstanceName;Database=myDataBase;Trusted_Connection=True;
Trusted connection from a CE device
- Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;User ID=myDomainmyUsername;Password=myPassword;
Connect via IP address
- Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
Enabling MARS(multiple active results sets)
- Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;MultipleActiveResultSets=true;
Attach a database file on connect to a local SQL Server Express Instance
- Server=.SQLExpress;AttachDbFilename=c:asdqwemydbfile.mdf;Database=dbname;Trusted_Connection=Yes;
Attach a database file,located in the data directory,on connect to a local SQL Server Express Instance
- Server=.SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf; Database=dbname;Trusted_Connection=Yes;
Using an user instance on a local SQL Server Express instance
- Data Source=.SQLExpress;Integrated Security=true;AttachDbFilename=|DataDirectory|mydb.mdf;User Instance=true;
Database Mirroring
- Data Source=myServerAddress;Failover Partner=myMirrorServer;Initial Catalog=myDataBase;Integrated Security=True;
Asynchronous processing
- Server=myServerAddress;Database=myDataBase;Integrated Security=True;Asynchronous Processing=True;
SQL Server 2005 specials [ context connection ]
C#程式碼
- using(SqlConnection connection = new SqlConnection(“context connection=true”))
- {
- connection.Open();
- // Use the connection
- }
Visual Basic程式碼
- Using connection as new SqlConnection(“context connection=true”)
- connection.Open()
- ` Use the connection
- End Using
相關文章
- JavaScript字串中URL的檢測並轉換為連結JavaScript字串
- 連結字串String.prototype.format字串ORM
- sqlserver2005預編譯SQLServer編譯
- golang json字串轉結構體GolangJSON字串結構體
- 如何把一個長連結轉短連結 短連結轉化器該如何使用
- 反轉連結串列
- 旋轉連結串列
- #反轉連結串列_C++版 #反轉連結串列_Java版 @FDDLCC++Java
- 1025 反轉連結串列
- 264反轉連結串列
- leetcode 反轉連結串列LeetCode
- 字串陣列轉為樹形結構字串陣列
- 資料結構之連結串列:206. 反轉連結串列資料結構
- 反轉連結串列、合併連結串列、樹的子結構
- 【LeetCode-連結串列】面試題-反轉連結串列LeetCode面試題
- Octave 數字轉字元,連線兩個字串,以及如何將字串轉換為變數名稱字元字串變數
- JavaScript 阻止超連結跳轉JavaScript
- 玩轉報表超連結
- leetcode 92 反轉連結串列ⅡLeetCode
- 連結串列反轉問題
- 206. 反轉連結串列
- 61. 旋轉連結串列
- 超連結的跳轉位置
- JAVA字串轉日期或日期轉字串Java字串
- JS json字串轉物件、物件轉字串JSON字串物件
- 新浪短連結生成 新浪短連結轉化器推薦
- xml字串轉JSON字串XML字串JSON
- **203.移除連結串列元素****707.設計連結串列****206.反轉連結串列**
- 點選連結取消跳轉效果
- TypeScript 實現連結串列反轉TypeScript
- JavaScript 阻止超連結的跳轉JavaScript
- 【Leetcode】61.旋轉連結串列LeetCode
- 反轉一個單連結串列。
- leetcode206. 反轉連結串列LeetCode
- 反轉連結串列系列問題
- java實現連結串列反轉Java
- leetcode 206.反轉連結串列LeetCode
- 翻轉連結串列常用寫法
- [leetcode 92] 反轉連結串列 IILeetCode