Response.BinaryWrite 放到WEB页面的问题
pp_zy 2005-07-08 02:56:51 我有一个asp文件的内容如下
<%
id=trim(request("id"))
Set rst=Server.CreateObject("ADODB.Recordset")
sqlstr="select filevalue,fileContentType from infomation where number=" & trim(request("id"))
'sqlstr="select * from movie_commends"
' sqlstr= sqlstr & " where id='" &id& "'"
rst.Open sqlstr,Session("strconn"),3,1
'sql="select filevalue,fileContentType from senddate where id=" & trim(request("id"))
Response.ContentType = rst("fileContentType")
Response.BinaryWrite rst("filevalue").getChunk(7500000)
rst.close
set rst=nothing
%>
这样是可以正常显示数据库里面的内容的
可是我把这段代码加到页面里面就会出现乱码,而不能正确调出数据库里面的内容,代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 2</title>
</head>
<body>
<%
id=trim(request("id"))
Set rst=Server.CreateObject("ADODB.Recordset")
sqlstr="select filevalue,fileContentType from infomation where number=" & trim(request("id"))
'sqlstr="select * from movie_commends"
' sqlstr= sqlstr & " where id='" &id& "'"
rst.Open sqlstr,Session("strconn"),3,1
'sql="select filevalue,fileContentType from senddate where id=" & trim(request("id"))
Response.ContentType = rst("fileContentType")
Response.BinaryWrite rst("filevalue").getChunk(7500000)
rst.close
set rst=nothing
%>
</body>
</html>
请哪位大虾能指点一下,加在页面里面就不能显示了,谢谢!