asp修改语句

来源:百度知道 编辑:UC知道 时间:2024/06/15 07:34:26
怎么修改不了数据??
<!-- #include file="mdb.asp" -->
<%
dim mc
mc=request.querystring("mc")
if request.QueryString("c")="cy" then
set rst=server.createobject("adodb.recordset")
rst.open "select * from cy where b_mc='"&mc&"'",conn,1,3
dim id1
id1=rst("b_id")
end if
if request.QueryString("act")="tijiao" then
dim id
id=request.QueryString("id")
set rst1=server.CreateObject("adodb.recordset")
rst1.open "select * from cy where b_id="&id,conn,1,3
rst1("b_mc")=request.Form("b_mc")
rst1("b_fl")=request.Form("b_fl")
rst1("b_kg")=request.Form("b_kg")
rst1("b_xh")=request.Form("b_xh")
rst1("b_sm")=request.Form("b_sm")
rst1.update
rst1.close
end if

获取参数的语句错误!:如下修改:
if request.Form("act")="tijiao" then
dim id
id=request.Form("id")
set rst1=server.CreateObject("adodb.recordset")
rst1.open "select * from cy where b_id="&id,conn,1,3
rst1("b_mc")=request.Form("b_mc")



if request("act")="tijiao" then
dim id
id=request("id")
set rst1=server.CreateObject("adodb.recordset")
rst1.open "select * from cy where b_id="&id,conn,1,3
rst1("b_mc")=request.Form("b_mc")

-------------错误原因----------
Request.Form 是取 post 方式传值,
Request.QueryString 是 get 方式传过来的值
request 可以获取post 和 get (method方式)的值
表单传值时应注意!!!
-------------------------------
其他:
如果你想修改后还在 chanpinxiugai2.asp 页面并显示修改的结果,则注意id的传递,修改如下:

if request.Form("act")="tijiao" then