-- 作者:kaituozhe
-- 发布时间:2017/11/25 19:36:00
-- 自动加载数据
If e.Table.Current IsNot Nothing Then Dim dr As DataRow = e.Table.Current.DataRow Dim wz As Integer = Tables("明细账").FindRow(dr) If wz >=0 Then Tables("明细账").Position = wz End If If Tables("明细账").current.Isnull("审核") = True e.Form.Controls("审核").TopMost = True e.Form.Controls("消审").backMost = True e.Form.Controls("ZengJiaXiang").Enabled = True e.Form.Controls("ShanChuXiang").Enabled = True e.Form.Controls("SanChu").Enabled = True Else e.Form.Controls("消审").TopMost = True e.Form.Controls("审核").backMost = True e.Form.Controls("ZengJiaXiang").Enabled = False e.Form.Controls("ShanChuXiang").Enabled = False e.Form.Controls("SanChu").Enabled = False End If \'Dim st As Date = Date.Now \'Forms("计算利息").StopRedraw Dim t2 As Table =Tables("计算利息_table2") Dim t3 As Table =Tables("计算利息_table3") Dim t4 As Table =Tables("计算利息_table4") With Tables("计算利息_table1") Dim Filter As String = "编号尾号 = \'" & .Current("编号尾号") & "\'" If .Current Is Nothing Then t2.Filter = "False" t3.Filter = "False" t4.Filter = "False" Else \'t2.DataTable.SQLL oad("Sel ect * From {明细账} where 编号尾号 = \'" & .Current("编号尾号") & "\'" ) \'t3.DataTable.SQLL oad("Sel ect * From {明细账} where 收据编号 = \'" & .Current("收据编号") & "\'" ) \'t4.DataTable.SQLL oad("Sel ect * From {明细账} where 项目名称 = \'" & .Current("项目名称") & "\'and 编号尾号 = \'" & .Current("编号尾号") & "\'") \'t2.DataTable.RemoveFor("编号尾号 <> \'" & .Current("编号尾号") & "\'" ) \'t2.DataTable.Appendload("编号尾号 = \'" & .Current("编号尾号") & "\'" ) \'t3.DataTable.RemoveFor("收据编号 <> \'" & .Current("收据编号") & "\'" ) \'t3.DataTable.Appendload("收据编号 = \'" & .Current("收据编号") & "\'" ) \'t4.DataTable.RemoveFor("项目名称 <> \'" & .Current("项目名称") & "\'and 编号尾号 = \'" & .Current("编号尾号") & "\'") \'t4.DataTable.Appendload("项目名称 = \'" & .Current("项目名称") & "\'and 编号尾号 = \'" & .Current("编号尾号") & "\'") \' t2.DataTable.load Filter = Filter t2.DataTable.load t3.DataTable.load Filter = "收据编号 = \'" & .Current("收据编号") & "\'" t3.DataTable.load t4.DataTable.load Filter = "项目名称 = \'" & .Current("项目名称") & "\'and 编号尾号 = \'" & .Current("编号尾号") & "\'" t4.DataTable.load End If End With \'Forms("计算利息").ResumeRedraw \'MessageBox.Show("耗时: " & (Date.Now - st).TotalSeconds & "秒") End If
上述代码黄色和红色部分加载数据需要0.9秒至1.3秒,绿色代码加载速度稍快一点,但是会提示如下错误:
.NET Framework 版本:2.0.50727.8689 Foxtable 版本:2017.10.26.1 错误所在事件: 详细错误信息: 列“_Identify”被约束为是唯一的。值“53577”已存在。
如何加载能够提高加载速度,绿色部分怎么修改?
|