[轉]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
相關文章
- [資料庫連線字串] Access 連線字串(轉)資料庫字串
- [資料庫連線字串]Access連線字串(轉)資料庫字串
- Awk 字串連線操作(字串轉數字,數字轉字串)字串
- JavaScript字串中URL的檢測並轉換為連結JavaScript字串
- 連結字串String.prototype.format字串ORM
- 讓輸入的連結字串自動可以點選跳轉程式碼字串
- 連結串列面試題(二)---連結串列逆序(連結串列反轉)面試題
- 反轉連結串列
- 旋轉連結串列
- 深入理解硬連結和軟連結 (轉)
- ADO連線資料庫字串大全 (轉)資料庫字串
- #反轉連結串列_C++版 #反轉連結串列_Java版 @FDDLCC++Java
- 動態連結庫(轉)
- 反轉連結串列、合併連結串列、樹的子結構
- 轉:10g新增功能實現字串連線字串
- 字串陣列轉為樹形結構字串陣列
- Oracle多行轉換成字串方法總結Oracle字串
- 【LeetCode-連結串列】面試題-反轉連結串列LeetCode面試題
- 玩轉報表超連結
- JavaScript 阻止超連結跳轉JavaScript
- 連結串列操作源程式 (轉)
- 61. 旋轉連結串列
- Octave 數字轉字元,連線兩個字串,以及如何將字串轉換為變數名稱字元字串變數
- 資料結構之連結串列:206. 反轉連結串列資料結構
- MySQL字串連線MySql字串
- mongodb連線字串MongoDB字串
- 【轉載】JDBC連線各種資料庫的字串JDBC資料庫字串
- Redis 的基礎資料結構(一) 可變字串、連結串列、字典Redis資料結構字串
- 推薦幾個長連結轉換短連結工具 最新短連結工具平臺推薦
- JAVA字串轉日期或日期轉字串Java字串
- java實現連結串列反轉Java
- leetcode 反轉連結串列LeetCode
- JavaScript 阻止超連結的跳轉JavaScript
- TypeScript 實現連結串列反轉TypeScript
- (一)Chrome書籤連結跳轉Chrome
- PHP連結oracle的函式 (轉)PHPOracle函式
- 按鈕連結乾坤大挪移 (轉)
- 翻轉連結串列常用寫法