Solved

ADO related question

Posted on 2004-10-04
9
180 Views
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.        
0
Comment
Question by:navinkaus
[X]
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
9 Comments
 
LVL 6

Expert Comment

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

http://support.microsoft.com/default.aspx?scid=kb;en-us;q126131
0
 

Author Comment

by:navinkaus
ID: 12216367
Thanks for your prompt reply but I am looking for ADO not ODBC
0
 
LVL 6

Expert Comment

by:Amritpal Singh
ID: 12216872
0
Independent Software Vendors: 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

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

Expert Comment

by:Amritpal Singh
ID: 12224001
ok no probs
0
 
LVL 2

Accepted Solution

by:
bcsonka earned 200 total points
ID: 12233729
Hi,

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.

0
 

Author Comment

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

http://www.4guysfromrolla.com/webtech/062799-3.report.shtml.
http://www.4guysfromrolla.com/webtech/112998-1.shtml

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.
0
 
LVL 2

Expert Comment

by:bcsonka
ID: 12242921
Hi,

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.
0
 

Author Comment

by:navinkaus
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
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

724 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