在C#中连接到数据库 [英] Connection to database in c#

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

问题描述

我有一个C#项目.在我的连接字符串中,我传递了userid = sa和password = sa123.问题是当我尝试在任何其他计算机上运行该应用程序时,都会引发错误消息.该消息是:用户无法登录.
当我在SQL Server中添加该用户时,没有错误,并且我的应用在另一台PC中打开.
那么,如何授予使用我的应用程序的所有用户权限?
否则我可以更改连接字符串,以便任何用户都可以运行该应用程序吗?

I have a c# project. In my connection string i''m passing userid=sa and password=sa123.The problem is that when i try to run the app in any other machine, it throws an error message.The message is : User cannot log in .
When i add that user in my sql server, there is no error and my app opens in the other pc.
So how can i give permission to all users that uses my application?
Or else can i change the connection string so that any user can run the app??

推荐答案

当满足以下情况之一时,就会发生此问题:
•已在Microsoft管理控制台(MMC)中启用仅允许匿名连接"安全设置.
•用户名没有用户管理器中的本地登录"权限.
•用户名在用户管理器中没有从网络访问此计算机的权限.
•未与用户名一起指定域名

您需要注意上面的列表才能解决此问题.
This problem occurs when one of the following scenarios is true:
•The Allow only anonymous connections security setting has been turned on in the Microsoft Management Console (MMC).
•The username does not have the Log on locally permission in User Manager.
•The username does not have the Access this computer from the network permission in User Manager.
•The Domain Name was not specified together with the username

You need to take care of the above list to resolve this issue.


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

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