连接数据库时出错 [英] error while connecting to database

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

问题描述

无法打开登录请求的数据库".登录失败.用户"的登录失败.

连接到数据库时会产生以下错误

web.config中的连接字符串

Cannot open database "" requested by the login. The login failed. Login failed for user ''''.

the following error is generated while connecting to database

connection string in web.config

<add name="Homeconstr" connectionString="Server=.\sqlexpress;database=CorporateDatabase1;Integrated Security=true">



aspx文件中的连接



connection in aspx file

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Homeconstr"].ConnectionString);
        con.Open();

推荐答案

参考: ConnectionString [

请参阅此内容可能对您有帮助

^ ]
Refer this may help you

http://sandroaspbiztalkblog.wordpress.com/2012/02/29/cannot-open-database-requested-by-the-login-the-login-failed-or-the-execute-permission-was-denied-on-the-object-database-schema-dbo/[^]


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

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