标颜色这段代码,为什么Tables("下采购订单_table2")当前行已经指定在最后一行了,却获取到的是表的第一行的数据。
Dim Book As New XLS.Book(ProjectPath & "Attachments\下采购订单大料.xls") '打开模板
Dim fl As String = ProjectPath & "Reports\下采购订单大料.xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
' Sheet(3,9).Value = "<日期= # " & Date.Today & "#>" '写入打印条件
book.AddDataTable("采购明细表","XSC_ERP","Select * f rom {采购明细表} where 采购单号= '" & Tables("下采购订单_table1").current("采购单号") & "'")
If Forms("下采购订单").opened
Dim dr As DataRow = DataTables("供应商").sqlfind("供应商简称= '" & Tables("下采购订单_table2").current("供应商属性_供应商名称") & "' and 供应商代码= '" & Tables("下采购订单_table2").current("供应商属性_供应商代码") & "'")
Dim dr1 As DataRow = DataTables("采购订单主表").sqlfind("采购单号= '" & Tables("下采购订单_table1").current("采购单号") & "'")
Sheet(3,10).Value = dr("全称")
Sheet(4,10).Value = dr("地址")
Sheet(5,10).Value = dr("联系人")
Sheet(6,10).Value = dr("联系手机")
Sheet(6,14).Value = dr("传真")
Sheet(1,15).Value = dr1("采购单号")
Sheet(49,2).Value = dr1("下单期")
End If
Book.Build() '生成报表
Book.Save(fl)
Dim Proc As New Process
Proc.File = fl
Proc.Start()