注册 登录
编程论坛 ASP技术论坛

ASP数据操作

asphh 发布于 2009-07-24 09:08, 421 次点击
哪位能提供一个ACCESS数据添加的代码呀,急要。
2 回复
#2
lhl6712009-07-24 14:40
<!--#include file="../../include/conn1.asp"-->
<%
action=request("action")
if action="add" then
       typeid=request("infotype")
    title=request("title")
    content=request("lr")
    picture=request("filename")
if picture<>"" then
    picture=c_path&""&picture
end if
 getconn
    sql="insert into product(typeid,title,content,picture,adddate) values('"&typeid&"','"&title&"','"&content&"','"&picture&"',now())"
    conn.execute(sql)
    closeconn
    response.write "<script language='javascript'>alert('增加成功');window.location='index.asp'</script>"
elseif action="edit" then
    cpid=request("cpid")
    typeid=request("infotype")
    title=request("title")
    content=request("lr")
    picture=request("filename")
    adddate=request("adddate")
    if picture<>"" then
        sql="picture='"&c_path&""&picture&"',"
    end if
        sql=sql&"typeid='"&typeid&"',title='"&title&"',content='"&content&"',adddate=now()"
    getconn
      sql="update product set "&sql&" where cpid="&cpid

    conn.execute(sql)
    closeconn
    response.write "<script language='javascript'>alert('编辑成功');window.location='index.asp'</script>"
elseif action="del" then
    cpid=request("cpid")
        getconn
    sql="delete from product where cpid="&cpid
    conn.execute(sql)
    closeconn
    response.write "<script language='javascript'>alert('删除成功');window.location='index.asp'</script>"
end if
%>
#3
yms1232009-07-24 15:05
这个是最基础的操作了。
1