-1
我有一個.asp頁面,它使用來自mysql數據庫的數據生成一個csv文件來下載。我的問題是,生成的csv文件的第一行是空白的。如何消除輸出中的空白第一行?經典的ASP導出爲CSV生成空白第一行
<%Response.Buffer = True
Response.Clear
Response.ContentType = "text/csv"
Response.AddHeader "Content-Disposition", "attachment;filename=export.csv"
struserid=Request.QueryString("uid")
set con = Server.CreateObject("ADODB.Connection")
%>
<!--#INCLUDE FILE="databaseconnection.asp"-->
<%Con.open DSNtest
set rec1=con.execute ("SELECT * FROM orders where receivedp = '0000-00-00 00:00:00' AND pid = '" & struserid & "' order by zipid asc")%>
sep=;
Address;City;State;Zip;
<%while not rec1.eof
strzipid = rec1("zipid")
set rec3=con.execute ("SELECT * FROM zip where zipcode = '" & strzipid & "'")
%>
<%=rec1("address")%>;<%=rec3("city")%>;<%=rec3("state")%>;<%=rec3("zipcode")%>;
<%rec1.movenext
wend
rec1.close
set rec1 = nothing
rec3.close
set rec3 = nothing
con.close
set con = Nothing%>
爲什麼在進行一次數據庫調用時進行嵌套的重複數據庫調用? 'SELECT * from orders AS o INNER JOIN zip AS z ON o.zipid = z.zipcode WHERE o.receivedp ='0000-00-00 00:00:00'AND o.pid ='「&struserid&」'order通過o.zipid asc'。閱讀JOINS:http://dev.mysql.com/doc/refman/5.0/en/join.html – 2014-11-07 00:49:12
感謝您的提示。我會研究它! – user2403260 2014-11-07 04:42:14