<!--#include file="conn.asp"-->
<%
Response.Charset="GB2312"
set rs=server.createobject("adodb.recordset")
modkey=cint(request("modkey"))
se=request("se")
if se="export" then
Response.ContentType="application/vnd.ms-excel"
end if
with response
.write "<table id='accountTable' width='3800' cellpadding='0' cellspacing='0'style='table-layout: auto'>"
.write "<tbody>"
.write "<tr class='FixedTitleRow'>"
.write "<th >系列<br>Range</th><th >款号<br>WorkNO</th><th>色号<br>ArtNO</th><th>交期<br>ReqDate</th><th>数量<br>Qty</th>"
.write "<th >备注(1)<br>Remark</th><th >备注(2)<br>Style Remark</th><th bgcolor='#ffff80'>车花</th><th bgcolor='#ffff80'>印花</th><th bgcolor='#ffff80'>收AD<br>日期</th>"
.write "<th bgcolor='#ffff80'>开单日期<br>纸样签收期</th><th bgcolor='#ffff80'>送衫日期<br>纸样签收期</th><th bgcolor='#ffff80'>布齐</th><th bgcolor='#ffff80'>开办会<br>日期</th>"
.write "<th bgcolor='#00FF80'>主身布种</th><th bgcolor='#00FF80'>主身布齐</th><th bgcolor='#00FF80'>纸样完成</th><th bgcolor='#00FF80'>排版日期</th><th bgcolor='#00FF80'>出围料日期</th><th bgcolor='#00FF80'>出小图日期</th><th bgcolor='#00FF80'>划样日期</th><th bgcolor='#00FF80'>已裁日期</th>"
.write "<th bgcolor='#ff80ff'>送裁片日期</th><th bgcolor='#ff80ff'>收车印花日期</th><th bgcolor='#ff80ff'>度尺日期</th><th bgcolor='#ff80ff'>完成日期</th><th bgcolor='#ff80ff'>预计完成日期<br>(已复办期)</th><th bgcolor='#ff80ff'>生产车间</th>"
.write "<th bgcolor='#ffff80'>跟单评分</th><th bgcolor='#ff80ff'>欠布/物料<br>Remarks 1</th><th bgcolor='#ffff80'>欠布物料<br>Remarks 2</th><th bgcolor='#ff00ff'>SMC回复<br>Remarks</th>"
.write "<th >车花厂</th><th >车花数</th><th >备注</th><th >印花厂</th><th >印花数</th><th >备注</th><th >烫章数</th><th >备注</th><th >无缝数</th><th >备注</th><th >压花</th><th >高周波数</th><th >备注</th>"
.write "</tr></thead><tbody>"
end with
rs.open sqlstr,conn,1,1
do while not rs.eof
response.write ...
next
loop
response.write "</tbody></table></div>"
以上的段落中
Response.Charset="GB2312"
Response.ContentType="application/vnd.ms-excel"
基本上没出现过问题,在我N多的导出时都很好用。但今天乱码了,靠。死想都解决不到问题的方法,找到过sql中看过它的编码规则是Chinese_PRC_CI_SA 。
终于忍不住要上网去查下和我一样乱码的朋友有多少,一查找,还真找到办法了。
解决方案:
在head区加入如下代码
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
在ASP页面输出加入如下代码:
Response.CharSet = "gb2312"
response.ContentType ="application/vnd.ms-excel"
这样解决了,呵呵,傻傻的解决了。