专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > LINQ

SQL 2008连接不上,求解解决方法

发布时间:2011-06-24 21:54:35 文章来源:www.iduyao.cn 采编人员:星星草
SQL 2008连接不上,求解
SQL Server配置管理器的SQl Server服务中除了SQL Full-text Filter Daemon Launcher(SQL)和SQl Server Agent(SQLEXPRESS),其他全部是正在运行状态,不知道是不是数据库设置不对还是source写的不对?(下面是运行的代码)

Sub Main(ByVal args() As String)

  Dim source As String = "server = local;" +
  "integrated security = SSPI;" +
  "database = MyDataBase"
  Dim selectstr As String = "SELECT [Name], [Password] FROM [UserTable]"

  Try
  Dim conn As SqlConnection = New SqlConnection(source)
  conn.Open() ''走到这里报错 

  Dim cmd As SqlCommand = New SqlCommand(selectstr, conn)
  Dim rowsReturned As Integer = cmd.ExecuteNonQuery()
  Console.WriteLine("{0} rows affect!")
  conn.Close()
  Console.WriteLine()
  Catch ex As Exception
  Console.WriteLine("12312312")
  Console.Read
  End Try

数据库名:MyDataBase
报错 内容:A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

------解决方案--------------------
大概看了一下意思,它说服务器没连上,让你检查一下是否允许远程连接
------解决方案--------------------
server = .;OK
------解决方案--------------------
探讨
SQL Server配置管理器的SQl Server服务中除了SQL Full-text Filter Daemon Launcher(SQL)和SQl Server Agent(SQLEXPRESS),其他全部是正在运行状态,不知道是不是数据库设置不对还是source写的不对?(下面是运行的代码)

Sub Main(ByVal args() As String)

Di……
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: