Foxtable(狐表)用户栏目专家坐堂 → System.InvalidOperationException: 当传递具有新行的 DataRow 集合时,Update 要求有效的 InsertCommand。


  共有5445人关注过本帖树形打印复制链接

主题:System.InvalidOperationException: 当传递具有新行的 DataRow 集合时,Update 要求有效的 InsertCommand。

帅哥哟,离线,有人找我吗?
cnsjroom
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
System.InvalidOperationException: 当传递具有新行的 DataRow 集合时,Update 要求有效的 InsertCommand。  发帖心情 Post By:2022/12/7 16:36:00 [显示全部帖子]

Dim Products As List(Of String)
Products =  DataTables("登记台账").GetValues("guid")
For Each Product As String In Products
    Output.Show(Product)
    Dim dr1 As DataRow = DataTables("登记台账汇总表").AddNew
    For Each dc As DataCol In DataTables("记台账").DataCols
        For Each dr As DataRow In DataTables("登记台账").datarows
            dr1(dc.Name) = dr(dc.Name)  
        Next
    Next
    dr1.save
Next

 

 

当前代码:【将上述正常使用的表用SQL与进行操作时,提示如下错误】

Dim cmd As New SQ LCommand
Dim dt,dt1,dt2 As DataTable
cmd.Conne ction Name = "主数据源"
cmd.Comm andText = "Selec t * From 登记台账"
Dim dt111 As DataTable = cmd.ExecuteReader()
cmd.CommandText = "Sele ct * From 登记台账汇总表"
Dim dt112 As DataTable = cmd.ExecuteReader()
Dim Products As List(Of String)
Products =  dt111.GetValues("guid")
For Each Product As String In Products
    Output.Show(Product)
    Dim dr1 As DataRow = dt112.AddNew
    For Each dc As DataCol In dt111.DataCols
        For Each dr As DataRow In dt111.datarows
            dr1(dc.Name) = dr(dc.Name)  
        Next
    Next
    dr1.save
Next

 

 

错误的事件名称
System.InvalidOperationException: 当传递具有新行的 DataRow 集合时,Update 要求有效的 InsertCommand。
2022-12-07 16:33:09


 回到顶部