asp+sql导出报表韩文写入的问题! myfile.writeline strLine 出错
<%dim rs,sql,filename,fs,myfile,x
Set fs=server.CreateObject("scripting.filesystemobject")
'--假设你想让生成的EXCEL文件做如下的存放
filename=Server.MapPath(""&request("exit")&".xls")'/////数据表保存的文件名
'--如果原来的EXCEL文件存在的话删除它
if fs.FileExists(filename) then
fs.DeleteFile(filename)
end if
'--创建EXCEL文件
set myfile=fs.CreateTextFile(filename,true)
'///////从数据库中把你想放到EXCEL中的数据查出来 )
Set rs=Server.CreateObject("ADODB.Recordset")
sql = "SELECT FileName,ActionDate,DeviceName,PrimaryOwner FROM AS c join dbo.ShadowCopyAction AS s on = WHERE ActionDate >= '"&asd&"' and ActionDate <= '"&qwe&"'"
rs.open sql,MM_conn_STRING,1,1
if not rs.EOF then
dim strLine,responsestr
strLine=""
For each x in rs.fields
strLine=strLine & x.name & chr(9)
Next
'--将表的列名先写入EXCEL
myfile.writeline strLine
Do while Not rs.EOF
strLine= ""
for each x in rs.Fields
strLine=strLine & x.value & chr(9)
next
'--将表的数据写入EXCEL
myfile.writeline strLine 当查询结果中有韩文时就出错。请高人指点一下!
rs.MoveNext
loop
end if
rs.Close
set rs=nothing
Response.Write "<BR><BR><center><b>点击下载报表操作</b></center>"
response.Write "<table width=90% cellspacing=1 cellpadding=3 align=center>"
Response.Write "<tr align=center> <td>"
response.write ("<font color=green>√</font><a href='"&request("exit")&".xls'>下载</a>")
Response.Write "</td></tr></table>"
%>