首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > vbScript >

帮小弟我看看这个程序

2012-02-13 
帮我看看这个程序%@LANGUAGEVBSCRIPT CODEPAGE936%!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0

帮我看看这个程序
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改页面</title>
</head>

<body>
<%
dim rs
dim sql
dim ConnStr
ConnStr="driver={sql server};server=127.0.0.1;database=qiche;uid=sa;pwd=123"
set Conn=server.createobject("adodb.connection")
Conn.Open ConnStr
set rs=server.CreateObject("ADODB.Recordset") 
aa=request("id")
sql="select * from chanpin where 产品编号='"& aa &"'"
rs.open sql,conn,1,3
%>

<form name="form1" method="post" action="xgjg.asp">
<table width="550" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#33CCFF">
  <tr align="center" valign="middle" bgcolor="#FFFFFF">
  <td height="30" colspan="4" bgcolor="#b7daf9">产品修改</td> </tr>
  <tr bgcolor="#FFFFFF">
  <td width="16%" height="30">产品编号:</td> 
<td height="30" colspan="3"><input name="bh" type="text" id="bh" value="<%=rs("产品编号")%>" size="30" maxlength="50"/> </td> </tr>
  <tr bgcolor="#FFFFFF"> 
  <td height="30">产品名称:</td> 
<td width="36%" height="30"><input name="mc" type="text" size="30" value="<%=rs("产品名称")%>" maxlength="50" id="mc"/> </td> </tr>
  <tr bgcolor="#FFFFFF"> 
  <td height="30">产品类型:</td> 
<td height="30" colspan="3"><input name="lx" type="text" size="30" value="<%=rs("产品类型")%>" maxlength="50" id="lx"/> </td> </tr>
  <tr bgcolor="#FFFFFF"> 
  <td height="30">产地:</td>
<td height="30" colspan="3"> <input name="cd" type="text" size="30" value="<%=rs("产地")%>" maxlength="50" id="cd"/> </td> </tr> 
  <tr bgcolor="#FFFFFF"> 
  <td height="30">制造商:</td> 
<td height="30" colspan="3"> <input name="zzs" type="text" size="30" value="<%=rs("制造商")%>" maxlength="50" id="zzs"/></td> </tr>
  <tr bgcolor="#FFFFFF"> 
  <td height="30">价格:</td> 
<td height="30" colspan="3"><input name="jg" type="text" size="30" value="<%=rs("价格")%>" maxlength="50" id="jg"/> </td> </tr>
<tr bgcolor="#FFFFFF"> 
<td height="30">&nbsp;</td>
<td height="30" colspan="3"><input type="submit" name="submit" value="修改"> 
<input type="reset" name="reset" value="重置"> </td> </tr>


</table>
</form>


   
</body>
</html>



<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<%  
  id1=Request.Form("mc")
  id2=Request.Form("lx")
  id3=Request.Form("cd")
  id4=Request.Form("zzs")
  id5=Request.Form("jg")
  id6=Request.Form("bh")
  set rs=server.CreateObject("ADODB.Recordset")
sql="update chanpin set 产品名称 ='"&id1&"', 产品类型 ='"&id2&"', 产地 ='"&id3&"',制造商 ='"&id4&"',价格 ='"&id5&"' where 产品编号='" &id6 &"'"
  rs.open sql,conn,1,2
%>

</body>
</html>
请大家帮我看看这个修改程序为什么实现不了!

[解决办法]
另外 你这两个页面的sql语句执行之前 得先判断下 是否有些取到的是空值
如果是空的话 就不执行下面的查询

热点排行