Sql server连接字符串问题 [英] Sql server connection string problem

查看:96
本文介绍了Sql server连接字符串问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



这是我的问题,



我在我的开发表单应用程序电脑。这是我的连接字符串:



Hello everyone ,

Here is my problem ,

I develop a form application in my computer. And here is my connection string :

"Server=localhost;Database=atak_db;Trusted_Connection=True;"





这是有效的。



现在我想在另一台计算机上安装此表单应用程序。



其他电脑也有sql server,并且已经在这台电脑上安装了相同的数据库。



但我的连接字符串在此计算机中不起作用。我也尝试过很多东西和连接线。



你对这个问题有什么建议吗?什么可以成为我的问题?我该如何解决这个问题?



and this is works.

Now i want to install this form application at another computer.

Other computer has sql server also and same database has been attached already in this computer.

But my connection string isn't work in this computer. I have tried a lot of things and connectionstrings also.

Do you have any suggestions about this issue ? What can be my problem ? How can i solve this ?

推荐答案

如果您将数据库从您的机器复制到另一台机器,您可能需要更改安全性。



奇怪的是,如果目标服务器具有与新连接的数据库相同的登录凭据,则它们不会同步。您必须删除以前的凭据并将其从服务器信用卡中添加回来。



当你使用Trusted_Connection = True时,检查数据库上是否设置了windows帐户,并且它具有访问权限写入(或者是所有者或其他)附带的数据库。



这是我每次数据库部署需要经历的烦恼> _<



希望有所帮助^ _ ^

Andy



更新:

一步一步:< br $> b $ b

If you have copies the database from your machine to another you may need to change the security.

Bizarrely, if the target server has the same login credentials as the newly attached database, they do not sync. You have to remove the previous credentials and add them back from the server creds.

As you're using Trusted_Connection=True, check the windows account is set up on the db and that it has access writes (or is owner or whatever) of the attached database.

This is an annoyance I have to go through with EVERY db deployment I do >_<

Hope that helps ^_^
Andy

UPDATE:
Step by step:



  1. 打开MSSQL Management Studio
  2. 查找数据库并展开
  3. 展开安全性/用户
  4. 删除Windows用户帐户
  5. 在服务器下:
  6. 展开安全性/登录
  7. 如果用户Windows帐户出现:


  1. 右键单击并选择属性



  • 如果帐号不存在:


    1. 右键单击登录文件夹
    2. 选择新登录
    3. 添加Windows用户帐户



  • 转到左侧的用户映射
  • 检查数据库以将其添加到
  • 选择他们应具有的角色
  • 单击确定
  • br mode =hold/>如果一切都按计划进行,那么应该将windows用户添加到数据库中并且Trusted_Connection = True;现在应该工作

    br mode="hold" />If all goes to plan then the windows user should be added to the database and the Trusted_Connection=True; should now work


    这篇关于Sql server连接字符串问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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