Delete records

Records can be deleted from the table in two ways. The pointer pointing to the current record is deleted.

 

Method 1

Delete method of the Recordset object deletes the current record from the table.

Syntax:-

Rsobject1.Delete

 Example:-

rsstudent.delete

where rsstudent is a  variable of recordset object

Method 2

Execute method of the Connection object executes an SQL statement such as insert, update and delete.

Syntax:-

Connobject1.Execute (sql) where sql statement is a valid DELETE statement and Connobject1 is the name of a connection object.

Example:-

Strdelete = ” Delete from student where age=20”

Connect1.execute (strdelete)

where Connect1 is a variable of connection object and strdelete is a variable name.