以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  不需要的编辑的内容保留原有数据  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=133269)

--  作者:yifan3429
--  发布时间:2019/4/10 23:57:00
--  不需要的编辑的内容保留原有数据

Dim e As RequestEventArgs = args(0)
Dim
wb As New weui
Dim
PageNumber As Integer = e.GetValues("page")
Dim
PrimaryKey As Integer = e.GetValues("key")
Dim
PageURL = "List.htm?page=" & PageNumber
If
e.PostValues.Count = 0 Then \'生成编辑页面
    Dim dr As DataRow = DataTables(
"
订单").SQLFind("[_Identify]=" & PrimaryKey)
    If dr IsNot Nothing Then
        wb.AddForm("","form1","edit.htm?key=" & PrimaryKey &  "&page=" & PageNumber)
        With wb.AddInputGroup("form1","ipg1",
"
编辑订单")
            .AddInput(
"
产品","产品","text").Value = dr("产品")
            .AddInput(
"
客户","客户","text").Value = dr("客户")
            .AddInput(
"
数量","数量","number").Value = dr("数量")
            With .AddInput(
"
单价","单价","number")
                .Step="0.01"
                .Value = dr(
"
单价")
            End With
            .AddInput(
"
日期","日期","date").Value = dr("日期")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1",
"
确定", "submit")
        End With
    Else
        With wb.AddMsgPage("","msgpage",
"
编辑失败", "此订单可能已经被删除!") \'提示用户此订单不存在.
            .icon= "Warn"
            .AddButton("btn1",
"
返回",PageURL) \'生成返回原来页面的按钮
        End With
    End
If

Else
\'保存编辑结果
    Dim dr As DataRow = DataTables(
"
订单").SQLFind("[_Identify]=" & PrimaryKey)
    If dr IsNot Nothing Then
        Dim nms() As String =
{"
产品","客户","数量","单价","日期"}
        For Each nm As String In nms
            dr(nm) = e.PostValues(nm)
        Next
        dr.Save()
       
\'显示完成提示,2妙手自动返回原来的页面
       
wb.AppendHtml("<meta http-equiv=\'refresh\' c>",True)
        wb.AddToast("","t1",
"
编辑完成",0).Visible = True
    Else
        With wb.AddMsgPage("","msgpage",
"
保存失败", "此订单可能已经被删除!") \'提示用户此订单不存在.
            .icon= "Warn"
            .AddButton("btn1","返回",PageURL) \'生成返回原来页面的按钮
        End With
    End
If
End
If
e
.WriteString(wb.Build) \'生成网页




http://www.foxtable.com/mobilehelp/scr/0120.htm


帮助中如果重新编辑保存就会代表重新写入数据  但是有100列  我只需要修改和编辑10行  现代的代码就会只有当前编辑的10行数据会更新,那么其余的行就会被清除数据  

我想要如何保护原来的历史数据。而不被删除


--  作者:有点甜
--  发布时间:2019/4/11 9:50:00
--  

如果你没有修改,你提交的时候,就是原来的值的啊,怎么可能是空值?

 

具体做个例子发上来说明。