如何使用vs2005自帶的sql2005 express
1.安裝VS2005時選擇SQL2005一併安裝,安裝完成後開始菜單隻有配置管理器;
2.到microsoft官方免費下載SQL2005管理工具Microsoft SQL Server Management
Studio Express Service Pack 2,
下載地址:
3.安裝Microsoft SQL Server Management Studio Express Service Pack 2;
4.打開Microsoft SQL Server Management Studio Express,用window認證登陸sqlserver;
5.新建查詢,輸入:
exec sp_password null,'你的密碼',sa
alter login sa enable
執行命令
6.在你的服務器(根節點)上右鍵-屬性,選擇安全性,把服務器身份驗證改爲SQL
Server 和 Windows 身份驗證模式;
7.重啓服務,完成。
8.使用字符串連接sql2005:
SqlConnection con = new SqlConnection(@"Data Source=localhost/SQLEXPRESS;Initial Catalog=testDB;Persist Security Info=True;User ID=sa;Password=123456");