日期:2014-05-16  浏览次数:20850 次

求大神写一个这样的修改和删除的代码
本帖最后由 awp5478 于 2013-08-06 16:54:39 编辑
<% if request.querystring("action")="add" then
if trim(request.form("sort"))="" then
response.Write "<script language=javascript>alert('请填写产品类别!');window.location.href='"&request.serverVariables("HTTP_REFERER")&"';</script>"
response.end
end if
set rs=server.createobject("adodb.recordset")
sql="select * from product_small_sort"
rs.open sql,conn,1,3
rs.addnew
rs("big_sortid")=server.HTMLEncode(trim(request.form("big_sortid")))
rs("sort")=server.HTMLEncode(trim(request.form("sort")))
rs("money")=server.HTMLEncode(trim(request.form("money")))
rs("danwei")=server.HTMLEncode(trim(request.form("danwei")))
rs("sx")=server.HTMLEncode(trim(request.form("sx")))
rs.update
response.Write "<script language=javascript>alert('添加产品小类成功!');window.location.href='"&request.serverVariables("HTTP_REFERER")&"';</script>"
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>

<% if request.querystring("action")="save" then
...
<% if request.querystring("action")="delete" then
...


求一个修改和删除的代码的代码

------解决方案--------------------
删除
conn.Execute "DELETE FROM product_small_sort WHERE 条件"


修改

Set strRs=Server.CreateObject("ADODB.Recordset")
strRs.Open "product_small_sort",conn,2,3
strRs.AddNew
rs("big_sortid")=server.HTMLEncode(trim(request.form("big_sortid")))
rs("sort")=server.HTMLEncode(trim(request.form("sort")))
rs("money")=server.HTMLEncode(trim(request.form("money")))
rs("danwei")=server.HTMLEncode(trim(request.form("danwei")))
rs("sx")=server.HTMLEncode(trim(request.form("sx")))
strRs.Update
'
strRs.Close
Set strRs=Nothing