Records can be added into the table in two ways:-
AddNew method of the Recordset object adds a blank record to the table. Update method of the recordset saves the record added to the table.
Rsobject1.AddNew where Rsobject1 is the name of the recordset.
rsstudent.Fields("FirstName") = “Sandra”
rsstudent.Fields("Age") = 25
where rsstudent is a variable of recordset object, Firstname and Age are the names of fields in a table.
NOTE:- Connect to the database and open the recordset before using the above code
Method 2Execute method of the Connection object executes an SQL statement such as insert, update and delete.
Connobject1.Execute (sql) where sql statement is a valid INSERT statement and Connobject1 is the name of a connection object.
Strinsert =”Insert into student (name, age) values (‘sandra’, 20)”
where Connect1 is a variable of connection object and strinsert is a variable name.
NOTE:- Connect to the database before using the above code (method 2)