ADO related question

Posted on 2004-10-04
Last Modified: 2013-11-20
Hi All,
        If I use command object and then execute the query , recordset returned by execute method is fast compare to calling open method of recordset with following parameters  Open("mast_sntlc_essence",vNull, adOpenStatic, adLockOptimistic, adCmdTable);      

      Could you tell me why one recordset which is returned by execute method of command object is fast compare to recordset with open method.

      Could you provide me any link or material which can tell me what are various parameters to use in diffenent condition ( add,modify,display,delete ) to a large database so that operation will be faster.        
Question by:navinkaus
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2

Expert Comment

by:Amritpal Singh
ID: 12216327
a related (but not exact) article at the followin link
plz have a look;en-us;q126131

Author Comment

ID: 12216367
Thanks for your prompt reply but I am looking for ADO not ODBC

Expert Comment

by:Amritpal Singh
ID: 12216872
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 12216915
I have gone through the above link but it does't  give answer of my question

Expert Comment

by:Amritpal Singh
ID: 12224001
ok no probs

Accepted Solution

bcsonka earned 200 total points
ID: 12233729

The Execute method's default cursor is forward-only/read-only.  The method that you are trying to execute with the _RecordsetPtr instance [Open("mast_sntlc_essence",vNull, adOpenStatic, adLockOptimistic, adCmdTable);] has a static/optimistic lock, however.  Static/Optimistic cursors use more resources than Forward-Only/Read-Only cursors, which is why the two methods have a performance difference.  Change your Open method to:

Open("mast_sntlc_essence",vNull, adOpenForwardOnly, adLockReadOnly, adCmdTable);

If I'm not mistaken, the performance of _RecordsetPtr's Open method should now be comparable to the _CommandPtr's Execute method.

I hope that helps.


Author Comment

ID: 12233942
Excatly I found the same answer on google. Please have a look on following link it helped me alot.

Could you just tell me which type of parameters we should use for following 4 methods. My thinking suggest for following things .

1. Add      ( through query )  command object
2. Modify  ( adOpenStatic, adLockOptimistic )
3. Delete  ( through query )  command object
4. Display ( adOpenForwardOnly, adOpenReadOnly,...)

  Just tell me the good and optimise way for above four methods.

Expert Comment

ID: 12242921

For add, update, and delete queries, you can use static/optimistic cursors but it really all depends on your requirements and what you're coding towards.  For select queries, forward-only/read-only is usually the way to go if you are just doing a once-through for the recordset.

Author Comment

ID: 12245342
Hi Bcsonka,
               I want to avoid static/optimistic cursors since just imagine you want to add new record then why should you waiste your time in creating recordset with static/optimistic it takes time instead you directly fire the query

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best tools for Backup and restore of Wordpress site 6 58
only14 challenge 19 89
java ^ examples 8 75
post4 challenge 28 121
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Suggested Courses

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question