帮忙修改一下SQL查询记录导入到EXCEL中的代码
代码如下:<%
DIM connstr
connstr=" PROVIDER=SQLOLEDB;DATA SOURCE=(local);UID=sa;PWD=;DATABASE=456"
set conn=server.CreateObject("ADODB.connection")
conn.open connstr
%>
<%
dim rs,sql,filename,fs,myfile,x
Set fs = server.CreateObject("scripting.filesystemobject")
filename = Server.MapPath("aspprogra.xls")
if fs.FileExists(filename) then
fs.DeleteFile(filename)
end if
Response.ContentType="application/vnd.ms-excel"
set myfile = fs.CreateTextFile(filename,true)
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select 代码,名称规格色别,入仓数,新进仓单号,制单号,供应商 from 进仓"
rs.Open sql,conn,1,1
if rs.EOF and rs.BOF then
else
dim strLine,responsestr
strLine=""
For each x in rs.fields
strLine = strLine & x.name & chr(9) & vbcrlf
Next
myfile.writeline strLine
Do while Not rs.EOF
strLine=""
for each x in rs.Fields
strLine = strLine & x.value & chr(9) & vbcrlf
next
myfile.writeline strLine 提示这句是没用参数或过程,
我想应该是上面一句strLine = strLine & x.value & chr(9) & vbcrlf没有得到正确的字符
rs.MoveNext
loop
end if
rs.Close
set rs = nothing
Response.Write "生成EXCEL文件成功!下载:<input type=""button"" value=""点击下载"" onclick=""javascript:window.open('aspprogra.xls')"">"
%>