以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 集变量使用方法再请教:字段名 in 字符串变量 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=134699) |
-- 作者:lanbor -- 发布时间:2019/5/4 16:33:00 -- 集变量使用方法再请教:字段名 in 字符串变量 Dim values As String=Nothing Dim i1 As Integer If Tables("pack99").Rows.Count>0 Then \'如果有记录 For Each dr As Row In Tables("pack99").Rows values=values & dr("order_id") & "," Next values=values.Substring(0,values.length - 1) 上面收集当前查询表中所有记录的数字型KEY键 messagebox.show(values) ‘结果显示有: 10,11,12,13,14 Dim Book As New XLS.Book(ProjectPath & "Attachments\\pack99_report.xls") \'9_report.xls") Dim sheet As XLS.Sheet = Book.Sheets(0) Dim Style As Xls.Style=book.NewStyle Style.BackColor=Color.Red ExcelPath="D:\\step00\\" Dim fl As String = ExcelPath & "ExcelReport\\pack99_report.xls" \'9_report.xls" book.AddDataTable("pack991","erp_opti","Se lect * fr om {pack99} where order_id in (values) ") \'在这里使用报错,order_id 是数字型 Key, book.Build() book.save( fl ) \'fl Dim proc As New Process Proc.file=fl proc.Start() End If 请教这句: book.AddDataTable("pack991","erp_opti","Se lect * fr om {pack99} where order_id in (values) ") \' 正确句法,order_id 是数字型 Key, 谢谢!谢谢!
[此贴子已经被作者于2019/5/4 16:35:47编辑过]
|
-- 作者:有点甜 -- 发布时间:2019/5/4 16:36:00 -- 1、 Next
2、
book.AddDataTable("pack991","erp_opti","Se lect * fr om {pack99} where order_id in (" & values.trim(",") & ") ") |
-- 作者:lanbor -- 发布时间:2019/5/4 16:48:00 -- 谢谢你,有点甜! 这个句法太经典了! |