i am updating a table in mysql using ADODB
i am adding new entries into a table
should i be using addnew or update?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s no difference, you will always use .Update to commit changes from where the current cursor is pointing at. AddNew allocates new row at the end of ADODB recordset
ADODB recordset is a cursor-based data set, when you load rows into recordset, the cursor is automatically on first row, so anything you do on recordset’s columns, it will modify wherever the recordset cursor is currently pointing at. For example:
This will update the first row:
This will update the next row:
To add a record (the cursor will move to last record)
This will update the last added record, after performing the step above:
If i remember correctly, MoveNext, MoveFirst, etc, implicitly call .Update before moving to new cursor location, so if you are in first row…
…Then you do:
…That will call .Update before moving to Paul McCartney. Anyway, don’t rely on it, just call .Update when you want to commit the changes on row