How ADO uses the delete syntax

Source: Internet
Author: User
Delete
Delete can delete more than one record, and you can use the where to set the conditional expression, and the record that matches the criteria is deleted.
The syntax is as follows:
DELETE [table name. *]
From table name
WHERE condition Expression
Use the drop statement to delete the entire table from the database, including the loss of the structure of the table, and delete to remove only the record data, but still retain the table's structure and the table's fields, indexed properties.
When you delete a record that is associated with another table, the association that is associated with the deleted record in the table name is deleted. For example, the Customer table name is associated with the order table, a record is deleted from the customer data, and the corresponding order record is deleted.
Records deleted with delete cannot be undone. You can use Select to use the same where condition expression to validate the results of a query, and then delete deletes.
Let's look at an example of using this SQL instruction in an ASP code.
For example, ASP code rs8.asp as follows, [delete from product where code = ' C2000 '], delete the record code-named C2000:
<%
Set conn1 = Server.CreateObject ("ADODB. Connection ")
Conn1. Open "dbq=" & Server.MapPath ("Ntopsamp.mdb") & ";D river={microsoft Access Driver (*.mdb)};D riverid=25;fil=ms Access; "
sql = "Delete from product where code = ' C2000 '"
Set a = conn1. Execute (SQL)
Set RS3 = Server.CreateObject ("ADODB. Recordset ")
sql = "SELECT * from Product order by kind DESC"
Rs3. Open sql,conn1,1,1,1
%>
<table colspan=8 cellpadding=5 border=0>
<TR>
&LT;TD align=center bgcolor= "#800000" ><font color= "#FFFFFF" > Code </FONT></TD>
&LT;TD align=center bgcolor= "#800000" ><font color= "#FFFFFF" > Name </FONT></TD>
&LT;TD align=center bgcolor= "#800000" ><font color= "#FFFFFF" > Price </FONT></TD>
&LT;TD align=center bgcolor= "#800000" ><font color= "#FFFFFF" > Quantity </FONT></TD>
</TR>
<% do, not RS3. EOF%>
<TR>
&LT;TD bgcolor= "F7efde" align=center><%= rs3 ("code")%></td>
&LT;TD bgcolor= "F7efde" align=center><%= rs3 ("name")%></td>

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.