Foxtable(狐表)用户栏目专家坐堂 → 改成函数


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

主题:改成函数

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


加好友 发短信
等级:六尾狐 帖子:1495 积分:12175 威望:0 精华:0 注册:2013/3/19 16:41:00
改成函数  发帖心情 Post By:2020/4/2 18:19:00 [只看该作者]

怎么把下面的代码改写成list函数呢?

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:ggg.zip


 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:111422 积分:567186 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/4/2 20:11:00 [只看该作者]

list函数

Dim e As RequestEventArgs = args(0)
Dim wb As New WeUI
Dim flt As String
If e.PostValues.ContainsKey("product") Then
    flt &= "年级 = '" & e.PostValues("product") & "'"
End If

If e.PostValues.ContainsKey("bj") Then
    If flt > "" Then
        flt = flt & " and "
    End If
    flt &= "班级= '" & e.PostValues("bj") & "'"
End If


If e.PostValues.ContainsKey("jdc") Then
    If flt > "" Then
        flt = flt & " and "
    End If
    flt & = "街道村 = '" & e.PostValues("jdc") & "'"
End If

If e.PostValues.ContainsKey("dqzt") Then
    If flt > "" Then
        flt = flt & " and "
    End If
    flt &= "当前状态 = '" & e.PostValues("dqzt") & "'"
End If

Dim page As Integer = 0 '默认page为0,显示第一页
Dim pageRows As Integer = 10 '每页10行
If e.GetValues.ContainsKey("page") Then  '如果地址中有page参数
    Integer.TryParse(e.GetValues("page"), page) '提取page参数
End If
Dim StartRow As Integer = page * pageRows + 1 '此页第一行
Dim EndRow As Integer = (page + 1) * pageRows '此页最后一行
'提取此页数据
Dim cmd As New SQLCommand
cmd.ConnectionName = "学校档案" '记得设置数据源名称

cmd.CommandText = "Select Count(*) From {控缀保学}"
'msgbox(3)
If flt > "" Then
    cmd.CommandText = cmd.CommandText & " where " & flt
End If

Dim Count As Integer = cmd.ExecuteScalar() '获取总的行数
cmd.CommandText = "Select * From (Select Row_Number() Over(Order by 出生日期) As [NO.],学生姓名,年级,班级,家长姓名,联系电话,地址 From 控缀保学"
If flt > "" Then
    cmd.CommandText = cmd.CommandText & " where " & flt
End If

cmd.CommandText = cmd.CommandText & ") As a "
cmd.CommandText = cmd.CommandText & "  Where [NO.]>= " & StartRow & " And [NO.] <= " & EndRow
'合成网页
With wb.AddTable("","Table1")
    .CreateFromDataTable(cmd.ExecuteReader)
    .Attribute = "style='width:550px'"
    ' .Alternate = 2 '每两行显示一个不同背景颜色的行
    '.RowHead = 1
    .ColWidth ="8px,45px,45px,45px,45px,100px"
    .ActiveSheet = "menu"
    .Primarykey = "_Identify" '设置主键
    
End With


With wb.AddButtonGroup("","btg2", False)
    If page > 0 Then
        .Add("btnPrev", "上一页","","List.htm?page=" & page - 1)
    End If
    If Endrow < count Then
        .Add("btnNext", "下一页","","List.htm?page=" & page + 1)
    End If
    If flt  = "" Then
        .Add("btn1", "筛选", "","filter.htm").kind = 1
    Else
        .Add("btn1", "取消筛选", "button", "default.htm").Kind = 2
    End If
End With
With wb.AddActionSheet("","menu") '设计菜单
    .Add("mnudAdd", "增加记录")
    .Add("mnuEdit", "编辑订单").Attribute ="onclick='kcbxedit'"
    .Add("mnuCancel","取消","",True)
End With
e.WriteString(wb.Build)


httprequest事件
    Case "kcbxfilter.htm"
        wb.AddForm("","form1","kcbxlist1.htm")
        With wb.AddInputGroup("form1","ipg1","疑似辍学学生查询")
            .AddSelect("product","年级","|九年级|八年级|七年级|六年级|五年级|四年级|三年级|二年级|一年级")
            .AddSelect("bj","班级","|(1)班|(2)班|(3)班|(4)班|(5)班|(6)班|(7)班|(8)班")
            .AddSelect("jdc","街道村","|铝厂居委会|峡西居委会|同兴村|同进村|广武村|三趟墩村|三台村")
            .AddSelect("dqzt","当前状态","|疑似辍学|休学|休假|送教|培训")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "确定", "submit")
        End With
        
        
    Case "kcbxlist1.htm"
       Functions.Execute("list",e)
       return

 回到顶部