简体   繁体   English

将错误写回数据表批量复制 C#

[英]Write back error to datatable bulkcopy C#

I want to make import data from.xlsx to database the flow as:我想让从.xlsx 导入数据到数据库的流程为:

xlsx->datatable->database xlsx->数据表->数据库

I copy data from excel to temp table and insert, update to official table later Everything above work OK but now i'm stucking at writing back error if have(data already had, constraint...) to specific field of corresponding row in datatable and view to DataGrid我将数据从 excel 复制到临时表并插入,稍后更新到官方表上面的一切工作正常但现在我坚持写回错误,如果有(数据已经有,约束......)到数据表中相应行的特定字段并查看 DataGrid

If you went through this problems, please advise me the best way to do it Thank you with highly appreciate.如果您遇到了这个问题,请告诉我最好的方法,非常感谢。

try to use this library https://www.nuget.org/packages/ExcelDataReader/ to read.xlsx and load in DataSet / DataTable.尝试使用这个库https://www.nuget.org/packages/ExcelDataReader/来读取.xlsx 并加载到 DataSet / DataTable 中。 Then run the validations in your datatable.然后在您的数据表中运行验证。

Its better to have a seperate datatable which you will be binding to DataGrid.最好有一个单独的数据表,您将绑定到 DataGrid。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM