vb.net如何连接sqlserver2005
2个回答
展开全部
先要声明 imports system.data.sqlcilent
后边连接(参考下):
Dim Sql1 As New SqlConnection
Dim CB As New SqlConnectionStringBuilder
CB.DataSource = "C010022\SQLEXPRESS"
CB.InitialCatalog = "服务器名称"
CB.UserID = "登陆名"
CB.Password = "密码"
Sql1.ConnectionString = CB.ConnectionString
Sql1.Open()
------数据库操作------
Sql1.Close()
后边连接(参考下):
Dim Sql1 As New SqlConnection
Dim CB As New SqlConnectionStringBuilder
CB.DataSource = "C010022\SQLEXPRESS"
CB.InitialCatalog = "服务器名称"
CB.UserID = "登陆名"
CB.Password = "密码"
Sql1.ConnectionString = CB.ConnectionString
Sql1.Open()
------数据库操作------
Sql1.Close()
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询