dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Beginner
May 11, 2000

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Deleting Fields from Recordset Object

Question:
I am using a disconnected recordset (adOpenStatic, adUseClient) which is obtained by executing a stored procedure using command an object. I tried to delete some fields from the recodset using rst.Fields.Delete "FieldName" syntax, only to get error saying this operation cannot be performed in this context. Any ideas why this might happen and how to make it work? I need to remove some fields from recordset at runtime as per user preferences.

Also I tried to append an existing Field object from a recordset to a new recordset ( created using set rst = new ADODB.Recordset) but failed. I think I was wrong on this one. Is there a way to take a few fields from existing recordset and copy them directly (with all data) over to another recordset ?

Answer:
You can only add and remove fields from a recordset while it is closed. To clone a recordset with only some of the fields you will have to instantiate a new recordset, append the desired fields, and then loop throught the source recordset and copy over the values.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date