Foxtable(狐表)用户栏目专家坐堂 → SQL事务 _SortKey没有保存


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

主题:SQL事务 _SortKey没有保存

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


加好友 发短信
等级:童狐 帖子:247 积分:2878 威望:0 精华:0 注册:2017/10/15 20:04:00
SQL事务 _SortKey没有保存  发帖心情 Post By:2021/9/4 21:21:00 [只看该作者]

  Dim pd As DataTable  '主表表
    Dim od As DataTable  '明细表
    Dim od2 As DataTable  '排产总表
    Dim cmd As New SqlCommand()
    cmd.C
    Try
        cmd.BeginTransaction()
        cmd.CommandText = "Selec t * Fro m 排产登记表_主表 Wher e [_identify] Is Null"  '无需加载任何数据
        pd = cmd.ExecuteReader(True)
        cmd.CommandText = "Selec t * Fro m 排产登记表_明细 Wher e [_identify] Is Null"
        od = cmd.ExecuteReader(True)

        
        Dim dr As DataRow = pd.AddNew() '增加一个订单,注意无需给新增行指定OrderID.
        Dim localtr As  Row =Tables("排产登记表_主表").Current
        dr("单据编号") = localtr("单据编号")
        dr("登记员") = localtr("登记员")
        dr("登记日期") = localtr("登记日期")
        dr("备注")=localtr("备注")
        dr("审核结果")="待审核"
        pd.Save()  '必须提前保存主表表, 这样主表ID列的值才是实际生成的主键值.
        For Each r As Row In Tables("排产登记表_明细").Rows
            Dim tr = od.AddNew()  '增加订单明细
            tr("_SortKey")=r("_SortKey")  ‘就这行数据 保存后在后台看数据发现_SortKey是没有数据的
            tr("商品编号")=r("商品编号")
            tr("排产目的")=r("排产目的")
            tr("生产数量")=r("生产数量")
            tr("最低数量")=r("最低数量")
            tr("最多数量")=r("最多数量")
            tr("打托")=r("打托")
            tr("控数")=r("控数")
            tr("备注")=r("备注")
            tr("父表ID")=dr("_identify")  '将自动生成的ID赋值给新增的订单明细
        Next
        od.save()


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106209 积分:540168 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/9/5 20:22:00 [只看该作者]

说明Tables("排产登记表_明细")本身就没有"_SortKey"数据,Tables("排产登记表_明细")是窗口表?怎么绑定数据的?


        For Each r As Row In Tables("排产登记表_明细").Rows
msgbox(r("_SortKey") )
            Dim tr = od.AddNew()  '增加订单明细
            tr("_SortKey")=r("_SortKey") 

 回到顶部