連接字符串中常用的聲明有
服務器聲明 Data Source
數據庫聲明 Initial Catalog和DataBase等
集成Windows賬號的安全性聲明 Integrated Security和Trusted_Connection等
使用數據庫賬號的安全性聲明 User ID和Password等
對於訪問數據庫的賬號來說
string ConnStr = "server = localhost;
user id = sa; password = xxx; database = northwind";
對於集成Windows安全性的賬號來說
string ConnStr = "server = localhost;
integrated security = sspi; database = northwind";
或string ConnStr = "server = localhost;
trusted_connection = yes; database = northwind";
使用Windows集成的安全性驗證在訪問數據庫時具有很多優勢
From:http://tw.wingwit.com/Article/program/SQLServer/201311/22259.html