以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 移动开发,为什么单击按钮两次可以筛选出数据 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=194822) |
-- 作者:zhchling -- 发布时间:2025/1/17 11:45:00 -- 移动开发,为什么单击按钮两次可以筛选出数据 单击某个按钮,例如 单击 “今日” ,第一次单击,可以显示今天的日期, 第二次单击,则筛选出今天的数据。 问题1: 第一次单击为什么不筛选出今天的数据? 问题2: 为什么两次单击,执行的内容会不同。 Dim wb5 As New WeUI Dim renshuguanwai As Integer Dim renshuwaidian As Integer Dim renshuzijia As Integer Dim renshushanmen As Integer Dim renshuweizhi As Integer Dim renshuzong As Integer Dim zclriqi As Date wb5.AddForm("", "form1", "list.htm") With wb5.AddButtonGroup("form1", "btg2", False) \'水平排列 .Add("btn3", "昨天", "submit").FormAction = "list.htm?btn=3" .Add("btn1", "今日", "submit").FormAction = "list.htm?btn=1" .Add("btn2", "明日", "submit").FormAction = "list.htm?btn=2" .Add("btn4", ">", "submit").FormAction = "list.htm?btn=4" .Add("btn5", "确定", "submit").FormAction = "list.htm?btn=5" End With Se*t Case e.Path Case "list.htm" Dim flt As String \' e.WriteString(e.PostValues("startdate")) If e.GetValues("btn") = 1 Then With wb5.AddInputGroup("form1", "ipg1", "数据筛选") .AddInput("startdate", "日期", "date").Value = date.Today \'e.PostValues("startdate") End With Else End If If e.GetValues("btn") = 2 Then With wb5.AddInputGroup("form1", "ipg1", "数据筛选") .AddInput("startdate", "日期", "date").Value = Date.Today.AddDays(1) \'e.PostValues("startdate") End With Else End If If e.GetValues("btn") = 3 Then With wb5.AddInputGroup("form1", "ipg1", "数据筛选") .AddInput("startdate", "日期", "date").Value = Date.Today.AddDays( - 1) \'e.PostValues("startdate") End With Else End If If e.GetValues("btn") = 4 Then With wb5.AddInputGroup("form1", "ipg1", "数据筛选") .AddInput("startdate", "日期", "date").Value = zclriqi.AddDays(1) End With Else End If If e.GetValues("btn") = 5 Then With wb5.AddInputGroup("form1", "ipg1", "数据筛选") zclriqi = e.PostValues("startdate") .AddInput("startdate", "日期", "date").Value = zclriqi End With End If flt = "日期=\' " & e.PostValues("startdate") & " \'" Dim cmd As New SQLCommand cmd.C cmd.CommandText = " Se*t 人数, 姓名, 手机, 酒店, 状态 From ({table_dingdan} Inner Join {table_kehu} On {table_kehu}.[idkehu] = {table_dingdan}.[idkehu]) " If flt > "" Then cmd.CommandText = cmd.CommandText & " where " & flt & " and ( 状态<>\'取消\' or 状态 is null ) Order By 酒店 " End If Dim dt As DataTable = cmd.ExecuteReader With wb5.AddTable("", "Table1") renshuguanwai = dt.compute("sum(人数)", "酒店=\'关外\'") renshuwaidian = dt.compute("sum(人数)", "酒店<>\'关外\' and 酒店<>\'自驾\' and 酒店<>\'\' and 酒店<>\'蓝景\' and 酒店<>\'希尔顿\' and 酒店<>\'皇冠\' and 酒店<>\'黄松浦\' and 酒店<>\'山门\' and 酒店<>\'奶头山\' ") renshuzijia = dt.compute("sum(人数)", "酒店=\'自驾\' ") renshushanmen = dt.compute("sum(人数)", "酒店=\'蓝景\' or 酒店=\'希尔顿\' or 酒店=\'皇冠\' or 酒店=\'黄松浦\' or 酒店=\'山门\' or 酒店=\'奶头山\' ") renshuweizhi = dt.compute("sum(人数)", " 酒店 is null ") renshuzong = dt.compute("sum(人数)") .CreateFromDataTable(cmd.ExecuteReader) With .Body.AddRow() .Attribute = "style=\'background-color:#FFFFE0\'" .AddCell("关外: " & renshuguanwai & "人,镇上外店人数:" & renshuwaidian & "人,自驾" & renshuzijia & "人,山门附近:" & renshushanmen & "人,其他人数:" & renshuweizhi & "人,总人数:" & renshuzong , "colspan=\'4\'") End With End With End Select e.WriteString(wb5.Build) |
-- 作者:有点蓝 -- 发布时间:2025/1/17 12:18:00 -- 调试每次点击后后台弹出什么内容 flt = "日期=\' " & e.PostValues("startdate") & " \'" 这里标颜色的空格要去掉 msgbox(flt ) |
-- 作者:zhchling -- 发布时间:2025/1/17 12:51:00 -- 当我先选昨天,日期是‘2025-01-16’的时候 第一次单击“今日”,弹出 ‘2025-01-16’ 第2次单击“今日”,弹出 ‘2025-01-17’ 筛选出今天的数据
|
-- 作者:zhchling -- 发布时间:2025/1/17 12:55:00 -- 找到原因了, |