[提问]
asp+mysql不能插入中文,1个月QQ会员作为报酬
|
|
popura
发表于 2011-11-10 02:28:07
|
显示全部楼层
先把你多余的第一行<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />去掉,然后贴出源代码。
[ 本帖最后由 popura 于 2011-11-10 02:29 AM 编辑 ] |
|
|
|
|
|
|
|
|
|
|
26722959
发表于 2011-11-10 08:30:04
|
显示全部楼层
我现在把页面源代码贴出来
-----------------------------------华丽的分割线-------------------------------------
<!--#include virtual="/test/conn.asp" --> ‘这里页面是 数据库连接代码
<%Session.CodePage=65001%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无标题文档</title>
</head>
<body>
<div style="border:1px #FF0000 solid; width:500px; height:300px;">
<%set rs=server.CreateObject("ADODB.recordset")
sql="select * from gset"
rs.open sql,conn,1,1
do while not rs.eof
%>
【<% =rs("s_id")%>】
【<% =rs("s_http")%>】
【<% =rs("s_closezs")%>】<%if rs("s_id")<>"1" then%>【<a href="?del=del&id=<% =rs("s_id")%>">删除</a>】<%end if%>
<br/>-------------------------<br/>
<%rs.movenext
loop
rs.close
set rs=nothing
%>
</div>
<div>
<form action="?tj=tj" method="post" >
<textarea name="kk" id="kk" cols="40" rows="5">
</textarea>
<input type="submit" value="提交">
</form>
</div>
<%if request.QueryString("tj")="tj" then
kk=request.Form("kk")
set rs=server.CreateObject("ADODB.recordset")
sql="select * from gset"
rs.open sql,conn,1,3
rs.addnew
rs("s_closezs")=kk
rs.update
rs.close
set rs=nothing
response.Write("<script>window.location.href='?'</script>")
end if
%>
<%if request.QueryString("del")="del" then
id=request.QueryString("id")
set rs=server.CreateObject("ADODB.recordset")
sql="select * from gset where s_id="&id
rs.open sql,conn,1,3
rs.Delete
rs.close
set rs=nothing
response.Write("<script>window.location.href='?'</script>")
end if
%>
<%conn.close
set conn=nothing
%>
</body>
</html>
[ 本帖最后由 26722959 于 2011-11-10 08:31 AM 编辑 ] |
|
|
|
|
|
|
|
|
|
|
26722959
发表于 2011-11-10 08:32:08
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
26722959
发表于 2011-11-10 08:32:40
|
显示全部楼层
回复 2# 的帖子
我现在把页面源代码贴出来
-----------------------------------华丽的分割线-------------------------------------
<!--#include virtual="/test/conn.asp" --> ‘这里页面是 数据库连接代码
<%Session.CodePage=65001%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无标题文档</title>
</head>
<body>
<div style="border:1px #FF0000 solid; width:500px; height:300px;">
<%set rs=server.CreateObject("ADODB.recordset")
sql="select * from gset"
rs.open sql,conn,1,1
do while not rs.eof
%>
【<% =rs("s_id")%>】
【<% =rs("s_http")%>】
【<% =rs("s_closezs")%>】<%if rs("s_id")<>"1" then%>【<a href="?del=del&id=<% =rs("s_id")%>">删除</a>】<%end if%>
<br/>-------------------------<br/>
<%rs.movenext
loop
rs.close
set rs=nothing
%>
</div>
<div>
<form action="?tj=tj" method="post" >
<textarea name="kk" id="kk" cols="40" rows="5">
</textarea>
<input type="submit" value="提交">
</form>
</div>
<%if request.QueryString("tj")="tj" then
kk=request.Form("kk")
set rs=server.CreateObject("ADODB.recordset")
sql="select * from gset"
rs.open sql,conn,1,3
rs.addnew
rs("s_closezs")=kk
rs.update
rs.close
set rs=nothing
response.Write("<script>window.location.href='?'</script>")
end if
%>
<%if request.QueryString("del")="del" then
id=request.QueryString("id")
set rs=server.CreateObject("ADODB.recordset")
sql="select * from gset where s_id="&id
rs.open sql,conn,1,3
rs.Delete
rs.close
set rs=nothing
response.Write("<script>window.location.href='?'</script>")
end if
%>
<%conn.close
set conn=nothing
%>
</body>
</html> |
|
|
|
|
|
|
|
|
|
|
lwbo1987
发表于 2011-11-10 09:09:27
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
26722959
发表于 2011-11-10 09:13:11
|
显示全部楼层
回复 7# 的帖子
请问怎么加N啊,我插入是这么写的
---------------------
set rs=server.CreateObject("ADODB.recordset")
sql="select * from gset"
rs.open sql,conn,1,3
rs.addnew
rs("s_closezs")=kk
rs.update
rs.close
set rs=nothing
----------------------- |
|
|
|
|
|
|
|
|
|
|
lwbo1987
发表于 2011-11-10 09:17:16
|
显示全部楼层
回复 8# 的帖子
|
我说你插入数据库的时候,在中文前面加上N看看,比如insert into table (name) values (N'名字') |
|
|
|
|
|
|
|
|
|
|
26722959
发表于 2011-11-10 09:35:15
|
显示全部楼层
insert into table (name) values (N'名字')
这段语法 我也看不懂 我只懂点点asp 插入的时候 不是这样写的
这N加在哪,“N测试“这样? 一样有问题;N"测试"这样报错
---------------------------
rs.addnew
rs("s_closezs")="N测试"
rs.update
----------------------------- |
|
|
|
|
|
|
|
|
|
|
lwbo1987
发表于 2011-11-10 09:45:03
|
显示全部楼层
|
|
|
|
|
|
|
|