Function add_del_update (Tablename,str,id)
Select Case Str
Case "Insert":
Sql= "SELECT * from [&tablename&] where id=null"
Rs.Open sql,conn,1,3
Rs.addnew
For each key in request. Form
' Response.Write ' rs ("&cstr (Key) &") = "&request (key) &" <br> "
RS (CSTR (key)) =request (key)
Next
Rs.update
Rs.close
Case "Update":
Sql= "SELECT * from [&tablename&] where id=" &id
Rs.Open sql,conn,1,3
For each key in request. Form
If key<> "id" then
RS (CSTR (key)) =request (key)
End If
Next
Rs.update
Rs.close
Case "Delete":
Sql= "Delete from [&tablename&] where id" ("&id&")
Rs.Open sql,conn,1,3
Case ""
End Select
End Function
%>
<%
' Add a record to the Table1 table
' Call Add_del_update ("table1", "Insert", "")
' Modify the id=5 in the Table1 table (ID is placed in the previous page action, or it can be a hidden form)
' Id=request ("id")
' Call Add_del_update ("table1", "update", ID)
' Delete some records in the Table1 table, the ID is in the previous page action, or it can be a form
' Id=request ("id")
' Call Add_del_update ("table1", "delete", id)
%>