Several methods of ASP deleting data in batches

Source: Internet
Author: User

Bulk Delete Data Method one

Id=request.form ("checkbox")
Id=split (ID, ",")
Shu=0
For i=0 to UBound (ID)
Sql= "SELECT * from Jiang_fname where id=" &id (i)
Set Rs=conn.execute (SQL)
If not rs.eof then
Delete_file (RS ("fname"))
End If
Rs.close
Set rs=nothing
Sql= "Delete from Jiang_fname where id=" &id (i)
Conn.execute SQL,SHU1
Shu=shu+1
Next

If Shu>0 Then
Response.Write ("<script>alert (' delete success '); location.href= '" &url& "';</script>")
Else
Response.Write ("<script>alert delete failed"); Web effects: History.back ();</script> ")
End If
Conn.close
Set conn=nothing

Method two uses SQL in

<%
Arrdel=request ("id")
' Response.Write Arrdel
Sql= "Delete from news where id" ("&arrdel&")
' Response.Write sql
Conn.execute SQL
Set conn=nothing
Response.Write "<script Language=javascript>alert (' Delete success! ');"
Response.Write "Javascript:history.go ( -1) </script>"
Response.End
%>

The above two batch deletion instance code, utilizes in the benefit is higher, also is simpler, uses the traversal feeling code to be some more.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.