<%
xingm=replace(trim(request.form("xingm")),"'","")
yi=replace(trim(request.form("yi")),"'","")
er=replace(trim(request.form("er")),"'","")
san=replace(trim(request.form("san")),"'","")
si=replace(trim(request.form("si")),"'","")
wu=replace(trim(request.form("wu")),"'","")
liu=replace(trim(request.form("liu")),"'","")
qi=replace(trim(request.form("qi")),"'","")
ba=replace(trim(request.form("ba")),"'","")
jiu=replace(trim(request.form("jiu")),"'","")
shi=replace(trim(request.form("shi")),"'","")
shiyi=replace(trim(request.form("shiyi")),"'","")
shier=replace(trim(request.form("shier")),"'","")
beizhu=replace(trim(request.form("beizhu")),"'","")
if xingm="" then
response.write "<SCRIPT language=JavaScript>alert('姓名不能为空 或 输入字符非法!');"
response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
end if %>
<%
set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from book"
rs.open sqlstr,conn,1,3
rs.addnew
rs("xingm")=request("xingm")
rs("yi")=request("yi")
rs("er")=request("er")
rs("san")=request("san")
rs("si")=request("si")
rs("wu")=request("wu")
rs("liu")=request("si")
rs("qi")=request("si")
rs("ba")=request("si")
rs("jiu")=request("si")
rs("shi")=request("si")
rs("shiyi")=request("si")
rs("shier")=request("shier")
rs("beizhu")=request("beizhu")
rs("jine")=request("yi")+request("er")+request("san")+request("si")+request("wu")+request("liu")+request("qi")+request("ba")+request("jiu")+request("shi")+request("shiyi")+request("shier")
rs.update
rs.close
conn.close
set rs=nothing
set conn=nothing
response.write "<script language=JavaScript>{window.alert('添加成功!');window.location.href='admin.asp';}</script>"
%>
其中的这一段
rs("jine")=request("yi")+request("er")+request("san")+request("si")+request("wu")+request("liu")+request("qi")+request("ba")+request("jiu")+request("shi")+request("shiyi")+request("shier")
jine 在数据库中的数字居然变成了yi+er+san+.....
比如yi=223 er=325
jine居然=223325 了 jine是求和 这段代码有什么问题么 请问高手
參考答案:request("er")传回了字符串:
用函数 CInt(request("er"))处理后再相加
如果有浮点数可换用 CDble(request("er"))处理