asp批量添加修改删除操作示例代码

ASP教程 2025-07-30

核心代码:

asp批量添加修改删除操作示例<%if request.Form(op)=update then'表单提交 ids=request.Form(ids) if ids<> then  response.Write 要删除的数据id集合:&ids&
'=========数据库删除操作 conn.execute(delete from xxx where id in(&ids&))'自己注意做安全验证,假定id为数字集合,自己正则RegExp判断有效性,pattern为^/d+(,/d+)*$ end if rows=request.Form(name).count'提交的数据行数据,包括添加/修改的 for i=1 to rows'遍历每行数据 id=request.Form(id).item(i)& name=request.Form(name).item(i) sex=request.Form(sex).item(i) age=request.Form(age).item(i) addr=request.Form(addr).item(i) if id<> then'修改操作,如果id为数字加isnumeric判断 response.Write 要修改数据行:&id&|&name&|&sex&|&age&|&addr&
'修改操作 else'添加操作 response.Write 要添加数据行:&name&|&sex&|&age&|&addr&
'添加操作 end if nextend if %>
姓名性别年龄地址删除
 

注:相关教程知识阅读请移步到ASP教程频道。