How to delete all records in Recordset?
We need to use "While..Loop" to delete all records.
The ASP codes are written and described as below:
<%
Set conn = Server.CreateObject("Adodb.Connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")
Set rs = Server.CreateObject("Adodb.Recordset")
rs.Open "Member",conn,1,3
Do While Not rs.EOF 'Start Looping to perform Delete function until the Recordset is empty
rs.Delete 'Delete the current record
Loop
rs.Close
Set rs = Nothing
%>
No comments:
Post a Comment