用户登录失败。尝试访问SQL Server Express数据库 [英] Login failed for user. Trying to access a SQL Server Express database

查看:121
本文介绍了用户登录失败。尝试访问SQL Server Express数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试访问我的SQL Server Express数据库,但每次尝试时,我收到此消息:

I'm trying to access my SQL Server Express database, but every time I try, I receive this message:


登录失败

Login failed for this user.

以下是代码:

sqlConnection cs = sqlConnection("Data Source=.\\SQLEXPRESS; 
   Initial Catalog=MyDatabase#4; Integrated Security=TRUE");
cs.Open();
MessageBox.Show(cs.State.ToString());
cs.Close();

如何解决这个问题?

推荐答案

尝试在数据源后写入您的计算机名称,而不是。例如:

Try to write your computer name instead of . after "Data Source". For example:

数据源= Michael-PC\\SQLEXPRESS;初始目录= MyDatabase#4;集成安全= True / code>

Data Source=Michael-PC\\SQLEXPRESS;Initial Catalog=MyDatabase#4;Integrated Security=True";

这篇关于用户登录失败。尝试访问SQL Server Express数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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