Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

达梦使用ExecuteDmBulkCopy报错仅当指定列列表,且SET IDENTITY_INSERT为ON时,才能对自增列赋值 #1846

Open
hangying-chen opened this issue Jul 2, 2024 · 6 comments

Comments

@hangying-chen
Copy link

hangying-chen commented Jul 2, 2024

数据库版本 达梦8

安装的Nuget包 FreeSql.Provider.Dameng 3.2.832

.net core 6.0

_freeSql.Insert<A>(data).InsertIdentity().ExecuteDmBulkCopy();

image

@2881099
Copy link
Collaborator

2881099 commented Jul 2, 2024

先用 ado执行把这个功能打开

@2881099
Copy link
Collaborator

2881099 commented Jul 2, 2024

using (var conn = await _freeSql.Ado.MasterPool.Get())
{
_freeSql.Ado.CommandFluent(sql).ExecuteNoQuery();
_freeSql.Insert(data).WithConnection(conn.Value).InsertIdentity().ExecuteDmBulkCopy();
}

@hangying-chen
Copy link
Author

我发现是在主键上设置了IsIdentity并没有起作用导致的,设置IsIdentity未True,但是生成的依旧不是自增列
image
image

@hangying-chen
Copy link
Author

我提出的问题的是从mysql转为达梦的,使用的达梦迁移工具,自增列也带上了

@2881099
Copy link
Collaborator

2881099 commented Jul 3, 2024

你说设置的特性生成的不是自增,但是我看你截图是自增字段

@hangying-chen
Copy link
Author

Id设置的特性IsIdentity是true,但是库里并不是自增列

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants