怎么用C#连接SQL SERVER 2005数据库
1个回答
展开全部
public Repository(string path, string db, string username, string password)
{
SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder();
csb.DataSource = path;
csb.UserID = username;
csb.Password = password;
csb.InitialCatalog = db;
connStr = csb.ConnectionString;
}
然后
using (SqlConnection connection = new SqlConnection(connStr))
path是服务器地址,db是数据库的名称,
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询