此主题相关图片如下:查询表行号变色.jpg
如上图与原来0319完全相同的代码,但原来版本点击目录树加载查询数据后计算库存时间左边行号不会变色,新版就会
目录树中点击的代码如下:
Dim tbl As Table = e.Form.Controls("Table1").Table
Functions.Execute("QueryTreeClick",e,tbl) '查询数据
'---计算显示库存时间
If DataTables(tbl.name).DataCols.Contains("库存时间(天)") = False Then
DataTables(tbl.name).DataCols.Add("库存时间(天)", Gettype(Integer)) '增加临时列
End If
Dim cmd As New SQLCommand
cmd.ConnectionName = Mydata
cmd.CommandText = "SE LECT 产品编码,MAX(进出日期) AS 进出日期 FROM dbo.uv_ck111 GROUP BY 产品编码"
Dim dt As DataTable = cmd.ExecuteReader()
Dim d1 As Date = Date.Today
tbl.StopRedraw
For Each r As Row In tbl.rows
If r("总库存") <> 0 Then '库存为0的不显示帐龄
Dim dr As DataRow = dt.Find("产品编码 = '" & r("产品编码") & "'")
If dr IsNot Nothing Then
Dim d2 As Date = dr("进出日期")
Dim tp As TimeSpan = d1 - d2
r("库存时间(天)") = tp.TotalDays
End If
End If
Next
虽然没有实质的影响,但也觉得有点不同,新版的这种改变正常吗?
谢谢!