VS2005中连接SQL2005的问题

来源:百度知道 编辑:UC知道 时间:2024/06/04 20:09:03
Dim myConnection As Data.SqlClient.SqlConnection
Dim myCommand As Data.SqlClient.SqlCommand
myConnection = New Data.SqlClient.SqlConnection("Data Source=104-STAND\SQLEXPRESS;Initial Catalog=plane;User ID=104-STAND\stand;")
myConnection.Open()
运行后出现
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - 管道的另一端上无任何进程。)
的错误提示

是为什么啊?怎么解决
New Data.SqlClient.SqlConnection("Data Source=104-STAND\SQLEXPRESS;Initial Catalog=plane;User ID=104-STAND\stand;")
是New Data.SqlClient.SqlConnection("server=104-STAND\SQLEXPRESS;database=plane;User ID=104-STAND\stand;")
前面打错了,这个问题怎么解决?

设断点调试一下!用你的代码改了一下很正常!我猜有2个可能:
1、连接字符串有误。
2、可能是SQLServer2005的设置有问题:
打开SQL Server Management Studio->登录名->sa->属性->状态。在右边有一个是否允许连接到数据库引擎,将“授予”选中。