ASP数据操作
哪位能提供一个ACCESS数据添加的代码呀,急要。
<!--#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
%>