除非使用集成安全性连接,否则SubmitChanges不起作用 [英] SubmitChanges does not work unless using Integrated Security connection

查看:62
本文介绍了除非使用集成安全性连接,否则SubmitChanges不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这样的示例代码:

void重命名(int id)

{

      var book = DatabaseContext.Books.Where(b => b.bookId == id).Single();

      book.Name =" newName";

      DatabaseContext.SubmintChanges();

}

bookId是主键。

在数据库连接字符串中使用Integrated Security时代码更新。但是如果使用用户/密码进行连接则不会更新。  用户对数据库具有读权限,权限和执行权限。

An example code like this:
void Rename(int id)
{
      var book = DatabaseContext.Books.Where(b=>b.bookId == id).Single();
      book.Name = "newName";
      DatabaseContext.SubmintChanges();
}
The bookId is primary key.
The code updates when using Integrated Security in database connection string. But it does not update if using user/password for the connection.  The user has read, right, and execute permission on the database.

我的环境如下: 

SQL server version:2012 

DataLinq.dll文件版本:4.0.30319.34211

应用程序运行于:Windows10或Windows Server 2012。

My environment is as following: 
SQL server version: 2012 
DataLinq.dll file version: 4.0.30319.34211
Application runs on: Windows10 or Windows Server 2012.

有什么想法吗?感谢帮助。

Any idea? Help is appreciated.

推荐答案

Franklin F. Wang,

Hi Franklin F. Wang,

根据您的描述,我使用SQL身份验证创建一个演示,它工作正常,请将您的连接字符串与下面的连接字符串进行比较。

Based on your description, I create a demo with SQL authentication, it works fine, please compare the connection string as below with yours.

<connectionStrings>
   <add name="LinqToSQLWithSQLAuthentication.Properties.Settings.EFDemoConnectionString"
            connectionString="Data Source=10.168.172.127;Initial Catalog=EFDemo;User ID=YourUserId;Password=YourPassword"
            providerName="System.Data.SqlClient" />
</connectionStrings>

此外,如果问题仍然存在,您是否遇到任何异常,可以请提供相关的连接字符串和详细的错误信息。

In addition, if the issue still exists, do you encounter any exception, could you please provide related connection string and detailed error message.

致以最好的问候,

Cole Wu


这篇关于除非使用集成安全性连接,否则SubmitChanges不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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