急》》》

Zhang_542800202_long 2009-09-17 03:35:25
添加商品后,点提交以后,型号数字后面多了一个","好,请高手帮忙看下,谢谢!



<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% if session("johnny")="" then:response.redirect ("index.asp"):end if %>
<!--#include file="conn.asp"-->
<%
action=request("action")

if action="addok" and trim(request("name"))<>"" then
pname=trim(request("name"))
pp=trim(request("pp"))
psize=trim(request("size"))
img=trim(request("img"))
classid=request("classid")

if IsNumeric(request("sclassid"))=True then
sclassid=request("sclassid")
else
sclassid=0
end if

text=request("text")
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from pro1"
rs.open sql,conn,1,3
rs.addnew
rs("name")=pname
rs("pp")=pp
rs("size")=psize
if img="" then
img="nopic.gif"
end if
rs("img")=img
rs("classid")=classid
rs("sclassid")=sclassid
rs("text")=text
rs("px")=rs.recordcount+1
rs.update
rs.close
set rs=nothing
response.redirect ("pro1.asp")
end if

if action="editok" and trim(request("name"))<>"" then
pname=trim(request("name"))
pp=trim(request("pp"))
psize=trim(request("size"))
img=trim(request("img"))
classid=request("classid")

if IsNumeric(request("sclassid"))=True then
sclassid=request("sclassid")
else
sclassid=0
end if

text=replace(request("text"),chr(34),chr(39))
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from pro1 where id="&request("id")
rs.open sql,conn,1,3
rs("name")=pname
rs("pp")=pp
rs("size")=psize
if img="" then
img="nopic.gif"
end if
rs("img")=img
rs("classid")=classid
rs("sclassid")=sclassid
rs("text")=text
rs.update
rs.close
set rs=nothing
response.redirect ("pro1.asp")
end if

if request("action")="del" then
Set rs= Server.CreateObject("ADODB.Recordset")
sql="delete * from pro1 where id="&request("id")
rs.open sql,conn,1,3
set rs=nothing
response.redirect ("pro1.asp")
end if

if request("tj")<>"" then
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from pro1 where id="&request("id")
rs.open sql,conn,1,3
if Cint(request("tj"))=1 then
rs("tj")=true
elseif Cint(request("tj"))=0 then
rs("tj")=false
end if
rs.update
rs.close
set rs=nothing
response.redirect ("pro1.asp")
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><!--#include file="title.asp"-->——网站后台</title>
<link href="admin.css" rel="stylesheet" type="text/css">
<% if request("action")="add" or request("action")="edit" then %>
<script language="javascript">
<!--
var subcat = new Array();
<%
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from sclass order by classid, px"
rs.open sql,conn,1,3
i=0
do while not ( rs.eof or rs.bof )
%>
subcat[<%= i %>] = new Array('<%= rs("classid") %>','<%= rs("sclass") %>','<%=rs("sclassid")%>')
<%
rs.movenext
i=i+1
loop
rs.close
set rs=nothing
%>
function changeselect1(locationid)
{
document.form1.sclassid.length = 0;
document.form1.sclassid.options[0] = new Option('++请选择子类别++','');
for (i=0; i<subcat.length; i++)
{
if (subcat[i][0] == locationid)
{document.form1.sclassid.options[document.form1.sclassid.length] = new Option(subcat[i][1], subcat[i][2]);}
}
}
function submitform()
{
var classid = document.form1.classid.value;
if (form1.classid.value=="") {
alert("请选择类别");
form1.classid.focus();
return (false);
}
}
//-->
</script>
<% end if %>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#336699">
<tr>
<td height="30" align="center"><b class="px16"><font color="#FFFFFF"><!--#include file="title.asp"-->——网站后台管理系统</font></b>
<table width="650" border="0" cellspacing="0" cellpadding="0"></table></td>
</tr>
<tr>
<td width="770" align="center"></td>
</tr></table>
<table width="100%" height="80%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="120" align="center" valign="top" bgcolor="#D4D0C8" class="dh_r_boder">
<!--#include file="dh.asp"-->
</td>
<td align="center" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#EEEDEA">
<tr>
<td height="23" valign="bottom" class="bt"><% if action="" then %>
班台列表
<% elseif action="add" then %>
添加班台
<% elseif action="edit" then %>
修改班台
<% end if %></td>
</tr>
<tr>
<td height="1" bgcolor="#000000" class="bt"></td>
</tr>
</table>
<table width="650" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10"></td>
</tr>
</table>
<% if action="" then %>
<table width="650" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10"></td>
</tr>
</table>
<table width="96%" border="1" cellspacing="0" cellpadding="0" bordercolordark="#FFFFFF" bordercolorlight="#000000">
<tr align="center">
<td colspan="2"><b><font color="#FF0000">所有班台</font></b></td>
</tr>
<tr align="center" bgcolor="#336699">
<td><b><font color="#FFFFFF">班台名称</font></b></td>
<td><b><font color="#FFFFFF">编辑</font></b></td>
</tr>
<%
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from pro1 order by px"
rs.open sql,conn,1,1
i=0
do while not ( rs.eof or rs.bof )
%>
<tr<%if i=1 then:Response.Write(" bgcolor='#EEEEEE'"):end if%>>
<td align="center"><%= rs("name") %></td>
<td width="98" align="center"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="44"><a href="?action=edit&id=<%= rs("id") %>"><img src="editbutton.gif" width="34" height="19" border="0"></a></td>
<td><a href="?action=del&id=<%= rs("id") %>" onClick="return confirm('确实要删除产品 “ <%= rs("name") %> ” 吗?')"><img src="delbutton.gif" width="34" height="19" border="0"></a></td>
</tr>
</table></td>
</tr>
<%
i=i+1
if i=2 then
i=0
end if
rs.movenext
loop
rs.close
set rs=nothing
%>
</table>
<% elseif action="add" then %>
<table width="640" border="0" cellspacing="0" cellpadding="0">
<form name="form1" method="post" action="pro1.asp" onSubmit="return submitform();">
<tr>
<td><font color="#FF0000">请认真填写以下各项</font></td>
</tr>
<tr>
<td><table width="640" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr bgcolor="#FFFFFF">
<td width="100" align="right" bgcolor="#EEEEEE">名称:</td>
<td><input name="name" type="text" id="name" size="34"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100" align="right" bgcolor="#EEEEEE">型号:</td>
<td><input name="text" type="text" id="text" size="34"></td>
</tr>

<tr bgcolor="#FFFFFF">
<td align="right" bgcolor="#EEEEEE">产品缩略图:</td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="img" type="text" id="img" size="25" readonly></td>
<td width="65" align="center"><a href="javascript:" onClick="window.open('up.asp?fp=../pro_pic&ft=img&fn=form1','_blank','width=300,height=100')">上传图片</a></td>
<td><font color="#FF0000">图片文件名不得使用中文</font></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value=" 提 交 ">
  
<input type="reset" name="Submit" value="重置">
<textarea name="text" style="display:none;"></textarea>
<input name="action" type="hidden" id="action" value="addok"></td>
</tr></form>
</table>

<% elseif action="edit" then
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from pro1 where id="&request("id")
rs.open sql,conn,1,1
pname=rs("name")
pp=rs("pp")
psize=rs("size")
img=rs("img")
classid=rs("classid")
sclassid=rs("sclassid")
text=rs("text")
id=rs("id")
rs.close
set rs=nothing
%>
<table width="640" border="0" cellspacing="0" cellpadding="0">
<form name="form1" method="post" action="pro1.asp" onSubmit="return submitform();">
<tr>
<td><font color="#FF0000">请认真填写以下各项</font></td>
</tr>
<tr>
<td><table width="640" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr bgcolor="#FFFFFF">
<td width="100" align="right" bgcolor="#EEEEEE">名称:</td>
<td><input name="name" type="text" id="name" value="<%=pname%>" size="34"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="100" align="right" bgcolor="#EEEEEE">型号:</td>
<td><input name="text" type="text" id="text" value="<%=text%>" size="34"></td>
</tr>


<tr bgcolor="#FFFFFF">
<td align="right" bgcolor="#EEEEEE">产品缩略图:</td>
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="img" type="text" id="img" size="25" readonly value="<%=img%>"></td>
<td width="65" align="center"><a href="javascript:" onClick="window.open('up.asp?fp=../pro_pic&ft=img&fn=form1','_blank','width=300,height=100')">上传图片</a></td>
<td><font color="#FF0000">图片文件名不得使用中文</font></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value=" 提 交 ">
  
<input type="reset" name="Submit2" value="重置">

<input name="action" type="hidden" id="action" value="editok">
<input name="id" type="hidden" id="id" value="<%=id%>"></td>
</tr></form>
</table>
<% end if %>
<table width="650" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10"></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" bgcolor="#000000" class="bai">今天是:<%= year(date) %>年<%= Month(date) %>月<%= day(date) %>日 </td>
</tr>
</table>
</body>
</html>
...全文
79 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
homel 2009-09-17
  • 打赏
  • 举报
回复
之前我也有出现过类似的情况,是因为数据类型为char(n)的情况下,若输入的数据小于n,系统会自动填满,如果大于,会自动给截断,
homel 2009-09-17
  • 打赏
  • 举报
回复
看看数据表的那个字段是不是char类型?

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧