Dim fl1 As String = "D:\wwwroot\bbs.yijiansoft.net\wwwroot\mobo\"
Dim wb As New weui
Dim e As RequestEventArgs = args(0)
Dim filter As String = " 门店名称 = '" & e.Cookies("md") & "' and 日期 = '" & e.Cookies("pdrq") & "' "
Dim bm As String = "查询表1" & Rand.Next()
Dim jb As New SQLJoinTableBuilder(bm, "明细表")
jb.C
jb.AddCols("门店名称")
jb.AddCols("库位")
jb.AddCols("条码")
jb.AddCols("数量")
jb.Filter = filter
'jb.Distinct = True
jb.Build()
Dim ex As New Exporter '& "pandianriqi" & e.Cookies("pdrq")
Dim name As String = e.Cookies("md") & Date.Today & "ri" & Date.now.hour & "shi" & Date.now.Minute & "fen" & Date.now.Second & "miao"
Dim name2 As String = e.Cookies("md") & Date.Today & "ri" & Date.now.hour & "shi" & Date.now.Minute & "fen" & Date.now.Second & "miao.txt"
ex.SourceTableName = bm '指定导出表 "盘点明细表"
ex.FilePath = "C:\inetpub\wwwroot\pandian\" '& name
ex.Fields = "库位,条码,数量" '指定导出字段
ex.Format = "Delimited"
ex.Header = False
ex.NewTableName = name
ex.Export() '开始导出
DataTables.UnLoad(bm)
Dim lj As String = "C:\inetpub\wwwroot\pandian\" & name2
Dim str As String = FileSys.ReadAllText(lj, Encoding.Default)
str = str.replace("""", "")
FileSys.WriteAllText(lj, str, False, Encoding.Default)
Dim fs As System.IO.FileStream = Nothing
fs = System.IO.File.Open(lj, System.IO.FileMode.Open)
Dim btFile As Byte() = New Byte(fs.Length - 1) {}
fs.Read(btFile, 0, Convert.ToInt32(fs.Length))
fs.Close()
e.Response.Headers("Content-Disposition") = "attachment;filename=" & name2
'输出文件格式
e.Response.C
Dim output = e.response.OutputStream
output.Write(btFile,0,btFile.Length)
output.Close()
甜老师你意思是说在最后加上 return 是吗?我试试
[此贴子已经被作者于2017/11/22 19:03:35编辑过]