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