Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO-Remove rows from RS object w/o affecting DB

Status
Not open for further replies.

BeanDog

Programmer
Jul 15, 2000
60
US
I have a recordset object that returns a long list of records. I loop through each in my VBScript to remove those that are not relevant. After I have done this, I display the information. I can not display the information while I go through the records. How do I remove rows from a Recordset object without deleting those rows from the underlying database?


~BenDilts( void );
benbeandogdilts@cs.com
Long-time BASIC game programmer, Internet programmer and C++/DirectX of late.
 
Disconnect the recordset from the DB.

eg:
dim conn, rec
set conn = server.createobject("adodb.connection")
conn.open "DSN=connection"
set rec = server.createobject("adodb.recordset")
rec.activeconnection = conn
rec.open "select * from table"
rec.activeconnection = nothing
conn.close
set conn = nothing

you now have a recordset that has been populated with the data from your database, but is no longer connected to it. This way, you can do all the modifications you want to the recordset, without affecting the underlying data. If you eventually need to update the DB with the changes, just set the .activeconnection = conn, then do rec.update...

that should work for you.

good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top