Hi,
I'm using ADODB.recordset and I want to delete specific records from my recordset.
I know how to do this in SQL but I'm unsure of how to do it with recordsets.
Can anyone help?
H.
Printable View
Hi,
I'm using ADODB.recordset and I want to delete specific records from my recordset.
I know how to do this in SQL but I'm unsure of how to do it with recordsets.
Can anyone help?
H.
Does anyone have any ideas on how to do this?
I want to be able to delete all records where the name = "example" from a recordset.
H.
You can open a recordset with an SQL DELETE function as the record source or- On your recordset use the filter property to just select the ones you want to delete and delete them all-
recordset.Filter = "Field = 'example'"
remember to turn the filter off afterwards to return to the ful recordset-
recordset.filter=""
Regards
Chris
Thank You!
H.
Sorry my last reply was misleading.
the first option should have said execute the SQL on the connection- e.g
sqlString = "DELETE * FROM table WHERE [field] = 'example';"
database.Connection1.Execute sqlString
To do this with recordset, i think you need to locate the record location first by the FindFirst method then follow by the delete method in you recordset object.