以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 数据更新,修改原数据不增加新记录 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=168920) |
-- 作者:xcxxm -- 发布时间:2021/5/27 8:26:00 -- 数据更新,修改原数据不增加新记录 If e.DataCol.Name = "入库" Then Dim nma() As String = {"入库","气名称","站点","日期","充装量","仓库"} \'A表数据来源列 Dim nmb() As String = {"本日入库","气名称","站点","日期","本日出库","仓库"} \'B表数据接收列 Dim dr As DataRow = DataTables("日统计").AddNew For i As Integer = 0 To nma.Length - 1 dr(nmb(i)) = e.DataRow(nma(i)) Next End If 上面代码只要表A数据有变化表B就会增加一条记录,现在是修改表A原来的行,表B不增加记录,在原来的记录上更新新的数据,这些代码改怎么写 请老师们指导一下,谢谢
|
-- 作者:有点蓝 -- 发布时间:2021/5/27 9:40:00 -- If e.DataCol.Name = "入库" Then Dim nma() As String = {"入库","气名称","站点","日期","充装量","仓库"} \'A表数据来源列 Dim nmb() As String = {"本日入库","气名称","站点","日期","本日出库","仓库"} \'B表数据接收列 Dim dr As DataRow = DataTables("日统计").find("编号=‘“ & e.DataRow("编号") & ”’") if dr is nothing then dr = DataTables("日统计").AddNew end if For i As Integer = 0 To nma.Length - 1 dr(nmb(i)) = e.DataRow(nma(i)) Next End If 自己把编号改为其它关联列
|
-- 作者:xcxxm -- 发布时间:2021/5/27 11:44:00 -- 老师 不行,又是增加了一条记录 |
-- 作者:有点蓝 -- 发布时间:2021/5/27 12:08:00 -- 说明查询条件设置不正确 |