asp读取数据库出现中文乱码
代码:<%@LANGUAGE="VBSCRIPT"CODEPAGE="65001"%><head><metahttp-equiv="Content-Type"conten...
代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
</body>
</html>
<% dim connstr,zdm,rc,comm,zystr,jstr,dstr,bhstr
on error resume next
set conn=server.createobject("adodb.connection")
ConnString = "DRIVER={Microsoft Access Driver (*.mdb)}; "
ConnString = ConnString & "DBQ=" & Server.MapPath("aa.mdb")
conn.open connstring
set rs=server.createobject("adodb.recordset")
sql="select * from gzgl"
rs.open sql,conn,1,3
comm=request.Form("comm")
zystr=request.Form("zy")
jstr=request.Form("j")
dstr=request.Form("d")
bhstr=request.Form("bh")
select case comm
case "insert"
rs.addnew
rs("zy")=zystr
rs("j")=jstr
rs("d")=dstr
rs.update
Response.Write("ok")
case "delect"
rs.find "bh =" & bhstr
if not rs.eof then
rs.delete
Response.Write("ok")
else
Response.Write("err")
end if
case "update"
rs.find "bh =" & bhstr
if not rs.eof then
rs("zy") = zystr
rs("j") = jstr
rs("d") = dstr
rs.update
Response.Write("ok")
else
Response.Write("err")
end if
end select
rs.movelast
Response.Write("&count="&rs.recordcount)
for rc=1 to rs.recordcount
for zdm=0 to rs.fields.count-1
Response.Write("&")
Response.Write(rs(zdm).name)
Response.Write(rc)
Response.Write("=")
Response.Write(rs(zdm))
next
rs.moveprevious
next
rs.close
set rs=nothing
conn.close
%>
结果:
&count=3&bh1=3&rq1=2012-2-9&zy1=kh&j1=0&d1=0&bh2=2&rq2=2012-2-8&zy2=ˆ?Ŀ??Ḑ&j2=0&d2=0&bh3=1&rq3=2012-2-8&zy3=?ط?&j3=324&d3=82
原来用iis就没乱码,现在iis有问题,换了netbox,就有乱码了 展开
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
</body>
</html>
<% dim connstr,zdm,rc,comm,zystr,jstr,dstr,bhstr
on error resume next
set conn=server.createobject("adodb.connection")
ConnString = "DRIVER={Microsoft Access Driver (*.mdb)}; "
ConnString = ConnString & "DBQ=" & Server.MapPath("aa.mdb")
conn.open connstring
set rs=server.createobject("adodb.recordset")
sql="select * from gzgl"
rs.open sql,conn,1,3
comm=request.Form("comm")
zystr=request.Form("zy")
jstr=request.Form("j")
dstr=request.Form("d")
bhstr=request.Form("bh")
select case comm
case "insert"
rs.addnew
rs("zy")=zystr
rs("j")=jstr
rs("d")=dstr
rs.update
Response.Write("ok")
case "delect"
rs.find "bh =" & bhstr
if not rs.eof then
rs.delete
Response.Write("ok")
else
Response.Write("err")
end if
case "update"
rs.find "bh =" & bhstr
if not rs.eof then
rs("zy") = zystr
rs("j") = jstr
rs("d") = dstr
rs.update
Response.Write("ok")
else
Response.Write("err")
end if
end select
rs.movelast
Response.Write("&count="&rs.recordcount)
for rc=1 to rs.recordcount
for zdm=0 to rs.fields.count-1
Response.Write("&")
Response.Write(rs(zdm).name)
Response.Write(rc)
Response.Write("=")
Response.Write(rs(zdm))
next
rs.moveprevious
next
rs.close
set rs=nothing
conn.close
%>
结果:
&count=3&bh1=3&rq1=2012-2-9&zy1=kh&j1=0&d1=0&bh2=2&rq2=2012-2-8&zy2=ˆ?Ŀ??Ḑ&j2=0&d2=0&bh3=1&rq3=2012-2-8&zy3=?ط?&j3=324&d3=82
原来用iis就没乱码,现在iis有问题,换了netbox,就有乱码了 展开
3个回答
展开全部
提交页面有这个吗?
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
你这里指定了文档编码格式为utf-8,你的源代码也要按utf-8来保存,要不然会出现乱码的
你这里指定了文档编码格式为utf-8,你的源代码也要按utf-8来保存,要不然会出现乱码的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询