设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 115|回复: 2
打印 上一主题 下一主题

ASP导出Excel,汉字变成了乱码,如何解决?

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-8 07:53:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<!--#include file="conn.asp"-->
<%
Response.ContentType="text/html"
Response.Charset="gb2312"
srhType=request("type")
srhKey=trim(request("key"))
if isempty(request("page")) or trim(request("page"))="" then
page=1
else
page=clng(request("page"))
end if
%>
<table width="99%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#666666">
<tr bgcolor="#E8F1FF" align="center">
<td>手机号码</td>
<td>短信类别</td>
</tr>
<%
set getInf=server.CreateObject("ADODB.Recordset")
getInf_sql="select * from [Note] where 1=1 "
if srhType<>"" then
getInf_sql=getInf_sql&"and dxpt_TelType="&clng(srhType)&" "
end if
if srhKey<>"" then
getInf_sql=getInf_sql&"and dxpt_TelNumber='"&srhKey&"' "
end if
getInf_sql=getInf_sql&"order by id desc"

getInf.open getInf_sql,conn,1,1
getInf.PageSize=5000
if page=0 then
page=1
end if
pages=getInf.PageCount
if page > pages then
page=pages
end if
getInf.AbsolutePage = page
for j=1 to getInf.PageSize
%>
<tr bgcolor="#FFFFFF" align="center">
<td><%=getInf("dxpt_TelNumber")%></td>
<td>
<%
set Get_TypeName=server.CreateObject("ADODB.Recordset")
Get_TypeName_Sql="select * from NoteSort where dxpt_SortID="&getInf("dxpt_TelType")
Get_TypeName.open Get_TypeName_Sql,conn,1,1
if not Get_TypeName.eof then
response.Write Get_TypeName("dxpt_SortName")
end if
Get_TypeName.close
set Get_TypeName=nothing
%> </td>
</tr>
<%
getInf.movenext
if getInf.eof then
exit for
end if
next
%>
<%
getInf.close
set getInf=nothing
%>
</table>
<%
dim fname
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
fname = int(fname) + int((10-1+1)*Rnd + 1)
response.ContentType ="application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=" & fname
%>
帮忙看下
2#
发表于 2010-1-8 07:53:56 | 只看该作者
Response.ContentType="text/html"楼主设置了该页为excel文件,为何还要设置text/html?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-19 14:28 , Processed in 0.074979 second(s), 9 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表