简体   繁体   English

数据集将不会插入

[英]dataset won't insert

I am trying to batch insert into a sql server table(TableX) with data from a dataset or datatable that was filled from a different sql table(TableY). 我正在尝试使用从不同的sql表(TableY)填充的数据集或数据表中的数据批量插入sql服务器表(TableX)。 The tables are identical in structure. 这些表的结构相同。 I get no errors at all. 我完全没有错误。 TableY just doesn't get inserted into. TableY只是没有插入。 I can fill a datatable with TableX, add a row and insert back into TableX and it works. 我可以用TableX填充数据表,添加一行并将其插入TableX,然后它可以工作。 It seems that if the data comes from a different database table it doesn't work. 看来,如果数据来自不同的数据库表,它将无法正常工作。 Could it be the schema info in the datatable that is causing this? 可能是数据表中的架构信息导致了此问题? I am only using SQL server tables as a test. 我仅使用SQL Server表作为测试。 It will eventually be between oracle and sql server. 最终它将在oracle和sql server之间。 Possibly other variations. 可能还有其他变化。

TableX----->Datatable----->Modify data-----Insert Into----->TableX: Works TableX ----->数据表----->修改数据-----插入到-----> TableX:

TableX----->Datatable----->Modify data-----Insert Into----->TableY: Doesn't Work TableX -----> Datatable ----->修改数据-----插入到-----> TableY:不起作用

作为数据集的CRUD操作一部分的插入语句仅适用于表X。您必须编写自定义插入语句才能插入表y。

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

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