不与数据库连接. [英] Does not connect with databse.

查看:67
本文介绍了不与数据库连接.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试打开sql server2005时,它给我错误

when i am trying to open sql server2005 it gives me error

Cannot connect to DELL-PC\SQLEXPRESS.

===================================

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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (.Net SqlClient Data Provider)


请帮助我|


plz help me|

推荐答案

尝试使用服务器资源管理器"窗格在VS中建立连接:
1)打开服务器资源管理器.
2)右键点击数据连接"并选择添加连接"
3)在随后的对话框中,选择您的数据源和数据库,指定安全信息,然后按测试连接".按钮.
4)连接正常后,按确定"
5)在服务器资源管理器"窗格中突出显示您的数据库,然后查看属性"窗格.将显示一个连接字符串的工作示例,您可以将其复制并粘贴到您的应用程序或配置文件中.

[edit]删除了粘贴操作添加的pre标签:doh:-OriginalGriff [/edit]
Try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file.

[edit]Removed pre tag added by paste operation :doh: - OriginalGriff[/edit]


sql连接字符串应如下所示,

如果sql server具有Windows身份验证模式
sql connection string should be like below,

if sql server have Windows authentication Mode
"data source=ServerName; Initial Catalog=DatabaseName; Integrated security=true;"


如果sql server具有SQL身份验证模式


if sql server have SQL authentication Mode

"data source=ServerName; Initial Catalog=DatabaseName; Uid=SQLServerLoginId;pwd=SQLServerPassword;" 


祝您编码愉快!
:)


Happy Coding!
:)


检查您的连接字符串.可能是您传递的凭据无法连接到数据库服务器.

谢谢
Check your connection string. May be credentials you are passing are not able to connect to you database server.

Thanks


这篇关于不与数据库连接.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆