日期:2014-05-16  浏览次数:20703 次

asp生成excel文件时乱码问题
用简单的生成excel出现了乱码,很多张表只有2张出现了问题。。。。求解决代码如下:
<!--#include file="connection.asp"-->
<%   
conn.Open ConnStr                                                                                         
set rs=server.createobject("adodb.recordset")  
strsql=session("strsql")
'lianjie = session("lianjie")
biao = session("biao")
chaxun_year=session("chaxun_year")
f_nianfen=session("chaxun_year")
session.Contents.Remove("chaxun_year")
session.Contents.Remove("f_nianfen")
 rs.open strsql,conn,1,3
if  rs.eof then
response.Write"<script>alert('对不起,没有您要查找的人!');history.back();</script>"
response.end
else
page=clng(request.QueryString("page"))
if page<=0  then
   page=1
  end if
  if request.QueryString("page")=""  then
  page=1
  end if
  rs.absolutepage=page
Response.ContentType = "application/vnd.ms-excel"
response.Charset="GB2312"
Response.AddHeader "Content-Disposition", "attachment;filename=训练.xls"
response.write "<table width=""100%"" border=""1"" >"
response.Write"<tr>"
response.write "<td colspan=""11"" align=""center""><b>训练汇总表 </b></td>"
response.Write"</tr>"
response.write "<tr>"
response.write "<td width=""40%"" align=""center""><b>姓名</b></td>"
response.write "<td width=""30%"" align=""center""><b>性别</b></td>"
response.write "<td width=""30%"" align=""center""><b>出生年月</b></td>"
response.write "<td width=""40%"" align=""center""><b>会员号</b></td>"
response.write "<td width=""30%"" align=""center""><b>家庭住址</b></td>"
response.write "<td width=""30%"" align=""center""><b>联系电话</b></td>"
response.write "<td width=""30%"" align=""center""><b>训练类别</b></td>"
response.write "<td width=""30%"" align=""center""><b>培训项目</b></td>"
response.write "<td width=""30%"" align=""center""><b>康复训练项目</b></td>"
response.write "<td width=""30%"" align=""center""><b>低保</b></td>"
response.write "<td width=""30%"" align=""center""><b>康复机构</b></td>"
response.write "</tr>"
   count=0
   do while not rs.eof
response.write "<tr>"
response.write "<td width=""40%"" align=""center"">"&rs("姓名")&"</td>"
response.write "<td width=""30%"" align=""center"">"&rs("性别")&"</b></td>"
response.write "<td width=""30%"" align=""center"">"&rs("出生年月")&"</td>"
response.write "<td width=""40%"" align=""center"">"&rs("会员证号")&"</td>"
resp