-- 作者:ouyangfenghuan
-- 发布时间:2019/5/2 11:47:00
-- WeUI中由DataTable生成的表格时间格式如何设定?
现有代码如下: 有3列要显示时间,现在显示不出来 Dim e As RequestEventArgs = args(0) \'获取要显示的页 Dim page As Integer = 0 \'默认page为0,显示第一页 Dim pageRows As Integer = 7 \'每页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 xm As String = e.Cookies("username") \'取用户名 xm= DecryptText(xm,"123","123") Dim d1 As Date = Date.Today.AddDays(-3)
Dim cmd As New SQLCommand cmd.C \'记得设置数据源名称 cmd.CommandText = "Select Count(*) Fro m {生产日报表} WHERE 日期 >= \'"
& d1 & "\'and 姓名 = \'" & xm & "\'" Dim Count As Integer = cmd.ExecuteScalar() \'获取总的行数
cmd.CommandText = "Select * Fro m (Select Row_Number() Over(Order by 日
期 desc) As [NO.],[_Identify],姓名,机台,订单编号,工序,机器时间,单次数
量生产,起始时间,结束时间,实际产量 Fro m {生产日报表} WHERE 日期 >= \'" &
d1 & "\'and 姓名 = \'" & xm & "\') As a " \'
\'产品,客户,数量,单价,日期 "姓
名","机台","订单编号","工序","机器时间","单次数量生产","起始时间","结
束时间","实际产量" cmd.CommandText = cmd.CommandText & " Where [NO.]>= " & StartRow & "
And [NO.] <= " & EndRow Dim dt As DataTable = cmd.ExecuteReader \'DataTables("订单").DataCols("日期").SetDateTimeFormat
(DateTimeFormatEnum.DateTime) dt.DataCols("起始时间").SetDateTimeFormat(DateTimeFormatEnum.DateTime) MessageBox.Show(dt.DataRows(0)("起始时间")) dt.DataCols("结束时间").SetDateTimeFormat(DateTimeFormatEnum.DateTime) MessageBox.Show(dt.DataRows(0)("结束时间")) dt.DataCols("机器时间").SetDateTimeFormat(DateTimeFormatEnum.LongTime) MessageBox.Show(dt.DataRows(0)("机器时间")) MessageBox.Show( DataTables("生产日报表").DataRows(0)("机器时间"))
\'生成菜单 Dim wb As New WeUI With wb.AddActionSheet("","menu") \'设计菜单 \'.Add("mnudAdd", "增加订单").Attribute="" \'调用
js函数 \'.Add("mnuEdit", "编辑订单").Attribute ="" \'.Add("mnuDelete", "删除订单").Attribute ="" \' .Add("mnudAdd", "增加报表").Attribute="" \'调用js
函数 .Add("mnuEdit", "更改报表").Attribute ="" .Add("mnuDelete", "删除报表").Attribute ="" .Add("mnuCancel","取消","",True) End With \'根据此页数据生成网页 With wb.AddTable("","Table1") .PageNumber = page \'设置页码 .Primarykey = "_Identify" \'设置主键 .ActiveSheet = "menu" \'设置菜单 .CreateFro mDataTable(dt) 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 End With With wb.AddButtonGroup("","btg3", False) \'生成上一页和下一页按钮 .Add("btn6", "返回首页","", "default.htm") End With wb.AppendHTML("<script src=\'./lib/table.js\'></script>") \'引入脚本文件 e.WriteString(wb.Build)
此主题相关图片如下:5.2-1.png
|