在GB2312编码和utf-8编码写入ACCESS数据库的问题
在GB2312编码中写入数据库正常,但是在utf-8编码中就写不到数据库是怎么回事?
<%If request("ac")="" then%><ul>
<%
Set mypage=new xdownpage
mypage.getconn=conn
mypage.getsql="select * from "&tbname&"_Guestbook where yn=1 order by id desc"
mypage.pagesize=10
set rs=mypage.getrs()
NoI=0
for i=1 to mypage.pagesize
if not rs.eof then
NoI=NoI+1
%>
<%
rs.movenext
else
exit for
end if
next
%>
</ul>
<%elseif request("ac")="add" then%>
<script language=javascript>
function chk()
{
if(document.form.title.value == "" || document.form.title.value.length > 15)
{
alert("不能提交留言,你的留言标题为空或大于15个字符!");
document.form.title.focus();
document.form.title.select();
return false;
}
if(document.form.content.value == "")
{
alert("请填写留言内容!");
document.form.content.focus();
document.form.content.select();
return false;
}
if(document.form.code.value == "")
{
alert("请填写验证码!");
document.form.code.focus();
document.form.code.select();
return false;
}
return true;
}
</script>
<form onSubmit="return chk();" method="post" name="form" action="?ac=post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="30" class="adgs">姓名:
<input name="UserName" type="text" id="UserName" maxlength="10"> </td>
</tr>
<tr>
<td height="30" class="adgs">联系方式:
<input name="title" type="text" id="title" maxlength="15" style="width:400px;border:1px solid #ccc;"></td>
</tr>
<tr>
<td height="30" class="adgs">产品类别:
<select name="ReContent">
<option>1</option>
<option>1</option>
</select></td>
</tr>
<tr>
<td height="15" class="adgs">详细内容:
<textarea name="content" cols="30" rows="6" id="content" style="width:400px;border:1px solid #ccc;margin:0;padding:0;height:100px;font-size:12px;line-height:120%;"></textarea></td>
</tr>
<tr>
<td height="30" class="adgs">验证码:
<input name="code" type="text" id="code" size="8" maxlength="5" style="border:1px solid #ccc;"/>
<img src="Inc/code.asp" border="0" alt="看不清楚请点击刷新验证码" style="cursor : pointer;" onClick="this.src='Inc/code.asp'"/>
</td>
</tr>
<tr>
<td height="30" align="center"><input type="submit" name="Submit" value=" 发 布 "></td>
</tr>
</table>
</form>
<%elseif request("ac")="post" then
dim UserName,Title,Content,ReContent
UserName = CheckStr(trim(request.form("UserName")))
Title = CheckStr(trim(request.form("Title")))
Content =request.form("Content")
mycode = trim(request.form("code"))
ReContent =request.form("ReContent")
If ChkSB(Content)=false Then
Call Alert("请不要乱发信息!",-1)
end if
If session("postgstime")<>"" then
posttime8=DateDiff("s",session("postgstime"),Now())
if posttime8<yaopostgetime then
posttime9=yaopostgetime-posttime8
Call Alert("请不要连续发表!",-1)
end if
End if
If Not Checkpost(True) Then Call Alert("禁止外部提交!","-1")
set rs = server.CreateObject ("adodb.recordset")
sql="select * from "&tbname&"_Guestbook"
rs.open sql,conn,1,3
if UserName="" or Title="" or Content="" then
response.Redirect "Guestbook.asp?ac=add"
end if
rs.AddNew
rs("UserName") =UserName
rs("ReContent") =ReContent
rs("Title") =Title
rs("Content") =Left(Content,200)
rs("AddIP") =GetIP
If bookoff=1 then
rs("yn") =1
else
rs("yn") =0
end if
rs.update
Session("postgstime")=Now()
If bookoff=0 then
Call Alert ("恭喜你,留言成功,但需要管理员审核后才能显示出来!","index.asp")
else
Call Alert ("恭喜你,申请提交成功!请等待管理员联系您确认详细资料","index.asp")
end if
rs.close
Set rs = nothing
end if%>