Results 1 to 6 of 6

Thread: DAO vs ADO ??

  1. #1

    Thread Starter
    Hyperactive Member naruponk's Avatar
    Join Date
    Feb 2004
    Location
    Some where in the world
    Posts
    423

    Question DAO vs ADO ??

    Hi,

    This question may look stupid.
    If i'm not wrong, ADO is faster than DAO,But can anyone explain to me that why when i work with ADO it looks slowly than DAO.
    selecting or compling sql statement also very slow.

    'ADO code when select
    select firstname,lastname,address,mobile from tbl1

    'DAO code when selct
    set rs=db.openrecordset("tbl1",dbopendynaset)

    'ADO code when using sql statement
    do while not rs.eof
    sql="insert into tbl1 (firstname) values(" & rs.fields!firstname & "')"
    loop

    'DAO code when using sql statement
    rs.addnew
    rs.fields!firstname=rs2.fields!firstname
    rs.update

    'there is >200K records

    if i explain not clearly please ask me for more info

    thanks

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    Assuming you are working on an access db - DAO is faster because it was optimised for Access. If you search online of for other threads this is explained.... Microsoft site have a bit on it.

    It also depends on your skills as a programmer, in the way you update it etc, as you can increase the time it takes to update a record in one method to the other.


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951
    I found that just using SQL statements was much slower on an ACCESS db. Now that I am converting to SQL Server, the SQL statements run much faster. If I had to do it again, and was staying with ACCESS, I woudl stay with DAO, unless there is a reason I needed ADO.

  4. #4
    Member magician's Avatar
    Join Date
    Jun 2002
    Location
    Dublin
    Posts
    48
    Originally posted by Ecniv
    Assuming you are working on an access db - DAO is faster because it was optimised for Access.

    Vince
    he is using different methosds to access/update database...
    in my own experience... IMHO ADO is much-much more faster ... but depends, how do access the DB

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    DAO was optimized fgor Access (both were built upon the Jet DBEngine). ADO is optimized for "higher" enterprise type databases, SQL Server, Oracle, etc.

    When using ADO to do work on an Access DB, it has to go through additional layers, which is why it seems slower. If the comparison was DAO/Access vs. ADO/SQL Server, I'd put my money on ADO/SQL.

    BTW: The DAO code to insert, could also be used as is (changing datatypes to ADO) in ADO.


    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6

    Thread Starter
    Hyperactive Member naruponk's Avatar
    Join Date
    Feb 2004
    Location
    Some where in the world
    Posts
    423
    Ok,

    'ADO
    do while not rs.eof
    rs.addnew
    rs.fields!firstname
    rs.update
    loop

    'DAO
    do while not rs.eof
    rs.addnew
    rs.fields!firstname
    rs.update
    rs.update

    If like this ADO would faster than DAO ?(in Acc97)
    can anyone give me a tip that how to do it faster? or this is ok?
    actually i would like to copy from 1 tbl to another one but dont want to copy all record.

    below is my code that i was used to update a record which is in criteria.

    'ADO
    do while not rs.eof
    sql="Update tbl1 set firstname='" & rs2.!fields!firstname & "' where ID>50"
    loop

    'DAO
    do while not rs.eof
    if rs!fields!ID>50 then
    rs.edit
    rs.fields!firstname=rs2.fields!firstname
    rs.update
    loop

    which is faster,any bug in my code

    thank you very much for all help this will help me to improve my skill

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width