本教程是一篇asp入门篇的初级教程了主要是讲asp access insert update delete 简单的使用哦好了下面我们把它们写在一个函数里面然后再举例说明
Function add_del_update(tablenamestrid)
Select Case str
Case "insert":
sql="select * from ["&tablename&"] where id=null"
rsopen sqlconn
rsaddnew
For Each key In requestForm
responsewrite "rs("&CStr(key)&")="&request(key)&"<br>"
rs(CStr(key))=request(key)
Next
rsupdate
rsclose
Case "update":
sql="select * from ["&tablename&"] where id="&id
rsopen sqlconn
For Each key In requestForm
if key<>"id" then
rs(CStr(key))=request(key)
end if
Next
rsupdate
rsclose
Case "delete":
sql="delete from ["&tablename&"] where id in("&id&")"
rsopen sqlconn
Case ""
End Select
End Function
%>
<%
向table表中添加一条记录
call add_del_update("table""insert""")
修改table表中的id=(id放在上一页action中也可以是隐藏表单)的记录
id=request("id")
call add_del_update("table""update"id)
删除table表中的一些记录id是上一页action中也可以是某一表单
id=request("id")
call add_del_update("table""delete"id)
%>