chaos_59
asked on
how can I copy an ADO database to a new database?
I want to connect to a database with the ADO data control, remove or edit a bunch of records and then save it to a different place. Is this possible? I haven't found anything in the help file or in the books I've been reading.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
chaos,
You can use a disconnected recordset.
1. Connect to source
rs.ActiveConnection.Open "DSN1"
2. Get a Recordset
3. Disconnect
rs.ActiveConnection.Close
4. Update the Records
5. Connect to a different source
rs.ActiveConnection.Open "DSN2"
6. Update
rs.UpdateBatch
I don't know whether this would work. It does sound reasonable, though.
gbaren
You can use a disconnected recordset.
1. Connect to source
rs.ActiveConnection.Open "DSN1"
2. Get a Recordset
3. Disconnect
rs.ActiveConnection.Close
4. Update the Records
5. Connect to a different source
rs.ActiveConnection.Open "DSN2"
6. Update
rs.UpdateBatch
I don't know whether this would work. It does sound reasonable, though.
gbaren
ASKER
This was the conclusion I was trying to avoid, but it seems like the only/best answer.
Thanks.
Thanks.
But also, generally you don't save a database. The database provider writes any changes you make automatically. Once you change the database, for all intents and purposes, it is changed. There is no original that you can revert to later after saving to a different file.
So with databases, copy then change, or extract then transform and import. Never change then save.