Foxtable(狐表)用户栏目专家坐堂 → 保存问题


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

主题:保存问题

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


加好友 发短信
等级:八尾狐 帖子:1953 积分:15015 威望:0 精华:0 注册:2016/4/28 9:58:00
保存问题  发帖心情 Post By:2017/9/17 20:57:00 [只看该作者]

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
If e.PostValues.Count = 0 Then '分组统计设置
    wb.AddForm("","form1","sjzd.htm")
    With wb.AddInputGroup("form1","ipg1","选择学期")
        .AddSelect("学期","学期","|17秋|18春")
    End With
    With wb.AddButtonGroup("form1","btg1",False)
        .Add("btn1", "确定", "submit")
        .Add("btn1", "返回").Attribute = ""
    End With
Else '显示统计结果
    Dim dr As DataRow = DataTables("用户").sqlfind("身份证号 = '" & e.Cookies("username") & "'")
    Dim pr As DataRow = DataTables("试卷征订").sqlfind("学校名称 ='" & dr("group") & "' and 学期 = '" & e.PostValues("学期") & "'")
    If pr Is Nothing
        pr = DataTables("试卷征订").AddNew()
        pr("学校名称") = dr("group")
        pr("学期")= e.PostValues("学期")
        pr.save()
    End If
    wb.AppendCookie("sjzdid",pr("_Identify"))
MessageBox.show(e.Cookies("sjzdid"))
    With wb.AddInputGroup("","ipg2","输入各年级试卷数")
        .AddInput("一年级","一年级","number").Value = pr("一年级")
        .AddInput("二年级","二年级","number").Value = pr("二年级")
        .AddInput("三年级","三年级","number").Value = pr("三年级")
        .AddInput("四年级","四年级","number").Value = pr("四年级")
        .AddInput("五年级","五年级","number").Value = pr("五年级")
        .AddInput("六年级","六年级","number").Value = pr("六年级")
        .AddInput("六年级","六年级","number").Value = pr("六年级")
        .AddInput("七年级","七年级","number").Value = pr("七年级")
        .AddInput("八年级","八年级","number").Value = pr("八年级")
        .AddInput("九年级","九年级","number").Value = pr("九年级")
    End With
    With wb.AddButtonGroup("","btg1", False)  '水平排列
        .Add("btn6", "确定保存","submit","sjzdsave.htm")
        .Add("btn7", "返回列表","button","xlist.htm")
    End With
   End If
e.WriteString(wb.Build)


sjzdsave:

Dim e As RequestEventArgs = args(0)
Dim  wb As New weui
Dim dr As DataRow
dr = DataTables("试卷征订").sqlfind("[_Identify] = '" & e.Cookies("sjzdid") & "'")
Dim nms() As String = {"一年级","二年级","三年级","四年级","五年级","六年级","七年级","八年级","九年级"} '不能为空的列名数组
messagebox.show(e.PostValues("七年级"))
For Each nm As String In nms
    If e.PostValues.ContainsKey(nm) Then
        dr(nm) = e.PostValues(nm)
    End If
Next
dr.Save()
'wb.AddToast("","t1", "已经保存",0).Msec= 1500
With wb.AddMsgPage("","msgpage","提交申请成功", "教研室已查收")
    .icon = "success" '改变图标
    .AddButton("btn1","返回").Attribute = ""
End With
e.WriteString(wb.Build)


老师,请问上面代码保存不起一年级,二年级各年级数据呢

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/9/17 21:46:00 [只看该作者]

跳转到保存的页面了吗?加入msgbox测试是否执行了里面的代码。

 

再有就是,你用的是sqlfind,保存后你要刷新同步表格才能看到最新的记录。

 


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


加好友 发短信
等级:八尾狐 帖子:1953 积分:15015 威望:0 精华:0 注册:2016/4/28 9:58:00
  发帖心情 Post By:2017/9/18 7:14:00 [只看该作者]

跳转到了的,保存提示都提示了,另外就是刷新后也没有保存值,
messagebox.show(e.PostValues("七年级"))用这个查show空值呢,实际是录了数据的,请老师帮查一下什么原因

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/9/18 9:21:00 [只看该作者]

Else '显示统计结果
    wb.AddForm("","form1","sjzdsave.htm")
    Dim dr As DataRow = DataTables("用户").sqlfind("身份证号 = '" & e.Cookies("username") & "'")
    Dim pr As DataRow = DataTables("试卷征订").sqlfind("学校名称 ='" & dr("group") & "' and 学期 = '" & e.PostValues("学期") & "'")
    If pr Is Nothing
        pr = DataTables("试卷征订").AddNew()
        pr("学校名称") = dr("group")
        pr("学期")= e.PostValues("学期")
        pr.save()
    End If
    wb.AppendCookie("sjzdid",pr("_Identify"))
    With wb.AddInputGroup("form1","ipg2","输入各年级试卷数")
        .AddInput("一年级","一年级","number").Value = pr("一年级")
        .AddInput("二年级","二年级","number").Value = pr("二年级")
        .AddInput("三年级","三年级","number").Value = pr("三年级")
        .AddInput("四年级","四年级","number").Value = pr("四年级")
        .AddInput("五年级","五年级","number").Value = pr("五年级")
        .AddInput("六年级","六年级","number").Value = pr("六年级")
        .AddInput("六年级","六年级","number").Value = pr("六年级")
        .AddInput("七年级","七年级","number").Value = pr("七年级")
        .AddInput("八年级","八年级","number").Value = pr("八年级")
        .AddInput("九年级","九年级","number").Value = pr("九年级")
    End With
    With wb.AddButtonGroup("form1","btg1", False)  '水平排列
        .Add("btn6", "确定保存","submit")
        .Add("btn7", "返回列表","button","xlist.htm")
    End With

 回到顶部