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.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist