devxlogo

Adding a New Record to ADO

Adding a New Record to ADO

Question:
I know there are two ways to insert a new record. One way is to execute a Insert statement, the other way is use the recordset.AddNew method.

In terms of performance, which one is better?When dealing with the memo field, which may contain single quotes or double quotes, is AddNew method the only way to go?

Answer:
The INSERT statement will give you better performance because you don’t have to create and pass around a recordset object. However the Recordset object gives you protection from data conflicts by raising an error if the user tries to update a record that has been modified by another user. So if you can do without the data conflict protection and want the performance then use a connection object to execute a SQL statement.

devx-admin

Share the Post: