主题:高手帮解决下问题:不能对数据库进行修改
update_form.asp
<% Option Explicit %>
<html>
<head>
<title>update_form</title>
</head>
<body>
<h2 align="center">修改记录</h2>
<%
dim varProductID
varProductID=Request.QueryString("ProductID")
Session("ProductID")=varProductID
%>
<!--#Include file="conn2.asp"-->
<%
//打开记录集
dim strSql,rs
strSql="Select * from Price where ProductID=" & varProductID
set rs=db.Execute(strSql)
%>
<center>
<table border="1" width="500" align="center">
<form name="form1" method="post" action="update.asp">
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">库存量</td>
<td width="75%" align="left"> <input type="text" name="stocks" style="width:250px" value="<%=rs
("stocks")%>"> <font color="#ff0000"></font></td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">淘宝一店</td>
<td width="75%" align="left"> <input type="text" name="Price_taobao1" style="width:250px" value="<%=rs
("Price_taobao1")%>"> <font color="#ff0000"></font></td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">淘宝二店</td>
<td width="75%" align="left"> <input type="text" name="Price_taobao2" style="width:250px" value="<%=rs
("Price_taobao2")%>"></td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">淘宝三店</td>
<td width="75%" align="left"> <input type="text" name="Price_taobao3" style="width:250px" value="<%=rs
("Price_taobao3")%>"></td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">淘宝四店</td>
<td width="75%" align="left"> <input type="text" name="Price_taobao4" style="width:250px" value="<%=rs
("Price_taobao4")%>"></td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">淘宝五店</td>
<td width="75%" align="left"> <input type="text" name="Price_taobao5" style="width:250px" value="<%=rs
("Price_taobao5")%>"> </td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">渠道</td>
<td width="75%" align="left"> <input type="text" name="Price_Channel" style="width:250px" value="<%=rs
("Price_Channel")%>"></td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">成本</td>
<td width="75%" align="left"> <input type="text" name="Price_Cost" style="width:250px" value="<%=rs
("Price_Cost")%>"></td>
</tr>
<tr bgcolor="#D4D0C8">
<td width="100%" align="center" colspan=2>
<input type="submit" name="S1" value="<修改>" >
<input type="reset" name="r1" value="<重写>">
<a href="list2.asp">返回</a>
</td>
</tr>
</form>
</table>
</center>
</body>
</html>
可以读取数据
<%
Option Explicit
Dim varStocks,varPrice_taobao1,varPrice_taobao2,varPrice_taobao3,varPrice_taobao4,varPrice_taobao5,varPrice_Cost,varPrice_Channel
varStocks=trim(request.form("Stocks"))
varPrice_taobao1=trim(request.form("Price_taobao1"))
varPrice_taobao2=trim(request.form("Price_taobao2"))
varPrice_taobao3=trim(request.form("Price_taobao3"))
varPrice_taobao4=trim(request.form("Price_taobao4"))
varPrice_taobao5=trim(request.form("Price_taobao5"))
varPrice_Cost=request.form("Price_Cost")
varPrice_Channel=trim(request.form("Price_Channel"))
%>
<!--#include file="conn.asp"-->
<%
Dim objRS,strSQL
set objRS=Server.createobject("adodb.recordset")
strSQL="select * from Pricer"
objRS.Open strSQL,objConn,1,1
objRS.AddNew
objRS("Stocks")=varStocks
objRS("Price_taobao1")=varPrice_taobao1
objRS("Price_taobao2")=varPrice_taobao2
objRS("Price_taobao3")=varPrice_taobao3
objRS("Price_taobao4")=varPrice_taobao4
objRS("Price_taobao5")=varPrice_taobao5
objRS("Price_Cost")=varPrice_Cost
objRS("Price_Channel")=varPrice_Channel
objRS.Update
objRS.Close
objConn.Close
Dim strJS
strJS=strJS+"<script language='javascript'>"
strJS=strJS+"alert('客户资料添加成功!');"
strJS=strJS+"location.href='list2.asp';"
strJS=strJS+"</script>"
response.write strJS
%>
这里就不行了,修改信息不能传到数据库!!!!!
<% Option Explicit %>
<html>
<head>
<title>update_form</title>
</head>
<body>
<h2 align="center">修改记录</h2>
<%
dim varProductID
varProductID=Request.QueryString("ProductID")
Session("ProductID")=varProductID
%>
<!--#Include file="conn2.asp"-->
<%
//打开记录集
dim strSql,rs
strSql="Select * from Price where ProductID=" & varProductID
set rs=db.Execute(strSql)
%>
<center>
<table border="1" width="500" align="center">
<form name="form1" method="post" action="update.asp">
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">库存量</td>
<td width="75%" align="left"> <input type="text" name="stocks" style="width:250px" value="<%=rs
("stocks")%>"> <font color="#ff0000"></font></td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">淘宝一店</td>
<td width="75%" align="left"> <input type="text" name="Price_taobao1" style="width:250px" value="<%=rs
("Price_taobao1")%>"> <font color="#ff0000"></font></td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">淘宝二店</td>
<td width="75%" align="left"> <input type="text" name="Price_taobao2" style="width:250px" value="<%=rs
("Price_taobao2")%>"></td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">淘宝三店</td>
<td width="75%" align="left"> <input type="text" name="Price_taobao3" style="width:250px" value="<%=rs
("Price_taobao3")%>"></td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">淘宝四店</td>
<td width="75%" align="left"> <input type="text" name="Price_taobao4" style="width:250px" value="<%=rs
("Price_taobao4")%>"></td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">淘宝五店</td>
<td width="75%" align="left"> <input type="text" name="Price_taobao5" style="width:250px" value="<%=rs
("Price_taobao5")%>"> </td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">渠道</td>
<td width="75%" align="left"> <input type="text" name="Price_Channel" style="width:250px" value="<%=rs
("Price_Channel")%>"></td>
</tr>
<tr>
<td width="25%" align="center" bgcolor="#D4D0C8">成本</td>
<td width="75%" align="left"> <input type="text" name="Price_Cost" style="width:250px" value="<%=rs
("Price_Cost")%>"></td>
</tr>
<tr bgcolor="#D4D0C8">
<td width="100%" align="center" colspan=2>
<input type="submit" name="S1" value="<修改>" >
<input type="reset" name="r1" value="<重写>">
<a href="list2.asp">返回</a>
</td>
</tr>
</form>
</table>
</center>
</body>
</html>
可以读取数据
<%
Option Explicit
Dim varStocks,varPrice_taobao1,varPrice_taobao2,varPrice_taobao3,varPrice_taobao4,varPrice_taobao5,varPrice_Cost,varPrice_Channel
varStocks=trim(request.form("Stocks"))
varPrice_taobao1=trim(request.form("Price_taobao1"))
varPrice_taobao2=trim(request.form("Price_taobao2"))
varPrice_taobao3=trim(request.form("Price_taobao3"))
varPrice_taobao4=trim(request.form("Price_taobao4"))
varPrice_taobao5=trim(request.form("Price_taobao5"))
varPrice_Cost=request.form("Price_Cost")
varPrice_Channel=trim(request.form("Price_Channel"))
%>
<!--#include file="conn.asp"-->
<%
Dim objRS,strSQL
set objRS=Server.createobject("adodb.recordset")
strSQL="select * from Pricer"
objRS.Open strSQL,objConn,1,1
objRS.AddNew
objRS("Stocks")=varStocks
objRS("Price_taobao1")=varPrice_taobao1
objRS("Price_taobao2")=varPrice_taobao2
objRS("Price_taobao3")=varPrice_taobao3
objRS("Price_taobao4")=varPrice_taobao4
objRS("Price_taobao5")=varPrice_taobao5
objRS("Price_Cost")=varPrice_Cost
objRS("Price_Channel")=varPrice_Channel
objRS.Update
objRS.Close
objConn.Close
Dim strJS
strJS=strJS+"<script language='javascript'>"
strJS=strJS+"alert('客户资料添加成功!');"
strJS=strJS+"location.href='list2.asp';"
strJS=strJS+"</script>"
response.write strJS
%>
这里就不行了,修改信息不能传到数据库!!!!!