以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  求助  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=74149)

--  作者:cqlistone
--  发布时间:2015/9/4 13:35:00
--  求助

你好!

订单表日期为datetime 单元格显示为2015-9-3  12:00

在获取最近10天信息时,报错显示时间格式不一致,怎么改代码 

 

Dim tbl As DataTable =  DataTables("订单")    

Dim StartDate As Datetime = Date.Today().AddDays(-10)

Dim lst As List(Of String) = tbl.GetValues("产品""[日期] > #" & StartDate & "#")  


--  作者:Hyphen
--  发布时间:2015/9/4 14:17:00
--  
代码测试通过,是不是数据有问题?
--  作者:大红袍
--  发布时间:2015/9/4 14:31:00
--  

设置成短日期

 

http://jingyan.baidu.com/article/647f0115925aee7f2148a8b5.html

 


--  作者:cqlistone
--  发布时间:2015/9/4 15:35:00
--  不筛选统计

这组代码显示的图是所有,没起筛选作用,帮忙看看哪里有问题

 

With Forms("报表").Controls("时段筛选") ‘ComboBox
    Dim txt1 As String = .Value
    If txt1 = "近一周"

 

Dim Chart As WinForm.Chart
Dim Series As WinForm.ChartSeries


Dim StartDate As new Datetime
StartDate= Date.Today.AddDays(-7)
Dim tbl As DataTable = DataTables("停机")
Dim lst As List(Of String) = tbl.GetValues("机器号","[申请时间] > # " & StartDate & " # ")


Chart = e.Form.Controls("Chart1")
Chart.ChartType = ChartTypeEnum.Bar
Chart.SeriesList.Clear()
Series = Chart.SeriesList.Add()
Series.Length = lst.Count
For i As Integer = 0 To lst.Count - 1
    Series.X(i) = i
    Series.Y(i) = tbl.Compute("Avg(总耗时)","[机器号] = \'" & lst(i) & "\'")
    Chart.AxisX.SetValueLabel(i, lst(i))
Next
Chart.AxisX.AnnoWithLabels = True
Series.DataLabelText = "{#YVAL}"   
Chart.VisualEffect = True         
End If
End With


--  作者:大红袍
--  发布时间:2015/9/4 15:39:00
--  
Series.Y(i) = tbl.Compute("Avg(总耗时)","[机器号] = \'" & lst(i) & "\' and [申请时间] > #" & StartDate & "# ")