Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2003
    Posts
    28

    Unanswered: Hybrid program problem (ADO + DAO)

    Hello,

    I use AccessXP. My program is hybrid (ADO + DAO) to manipulate data in JET database and I found a lot of problems. This is one I would like to know :

    Due to my program is hybrid, if I add records to a table by using ADO and another form bound to query that is based on that table. That form will not be updated immediately although I force it to do by using form.Requery method. Actually, Sometime it does, sometime it not. I think this is because Access form read data in its own cache which is not up-to-date.

    Question is Does it have something I can do to force data in my ADO object to be flush to database AND force JET to refresh data from database into cache? (I think I have to do it both. Doing only one part might not guarantee. Now, I don't think by force form to Requery will help because form still get expired-data from cache. Force JET to do that should be the correct solving)

    Actually, If I use only DAO, no problem is found. But I'ld like to change to ADO. I still don't know How to make application to be only ADO model. AFAIK, Form always return DAO recordset. This is why my application is hybrid.

    Sorry for long explanation, I hope you will understand. My english is not good.

    TIA

  2. #2
    Join Date
    Oct 2003
    Location
    US
    Posts
    343

    Re: Hybrid program problem (ADO + DAO)

    There is no problem in having both methodologies in an application. Wether you use ADO or DAO it doesn't matter. First make sure that you are calling them properly. When you have both DAO and ADO libraries you have to define your variables like

    dim rs as ADO.Recordset
    dim db as DAO.Database

    Now you have to tell us what do you mean by immediately update. Do you update the records and then open the form and still can't see the updated records or what ???


    Originally posted by suntisuk
    Hello,

    I use AccessXP. My program is hybrid (ADO + DAO) to manipulate data in JET database and I found a lot of problems. This is one I would like to know :

    Due to my program is hybrid, if I add records to a table by using ADO and another form bound to query that is based on that table. That form will not be updated immediately although I force it to do by using form.Requery method. Actually, Sometime it does, sometime it not. I think this is because Access form read data in its own cache which is not up-to-date.

    Question is Does it have something I can do to force data in my ADO object to be flush to database AND force JET to refresh data from database into cache? (I think I have to do it both. Doing only one part might not guarantee. Now, I don't think by force form to Requery will help because form still get expired-data from cache. Force JET to do that should be the correct solving)

    Actually, If I use only DAO, no problem is found. But I'ld like to change to ADO. I still don't know How to make application to be only ADO model. AFAIK, Form always return DAO recordset. This is why my application is hybrid.

    Sorry for long explanation, I hope you will understand. My english is not good.

    TIA

  3. #3
    Join Date
    Nov 2003
    Posts
    28

    Re: Hybrid program problem (ADO + DAO)

    Originally posted by khan
    Now you have to tell us what do you mean by immediately update. Do you update the records and then open the form and still can't see the updated records or what ???
    Yes, That's right.

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Hybrid program problem (ADO + DAO)

    Originally posted by suntisuk
    Hello,

    I use AccessXP. My program is hybrid (ADO + DAO) to manipulate data in JET database and I found a lot of problems. This is one I would like to know :

    Due to my program is hybrid, if I add records to a table by using ADO and another form bound to query that is based on that table. That form will not be updated immediately although I force it to do by using form.Requery method. Actually, Sometime it does, sometime it not. I think this is because Access form read data in its own cache which is not up-to-date.

    Question is Does it have something I can do to force data in my ADO object to be flush to database AND force JET to refresh data from database into cache? (I think I have to do it both. Doing only one part might not guarantee. Now, I don't think by force form to Requery will help because form still get expired-data from cache. Force JET to do that should be the correct solving)

    Actually, If I use only DAO, no problem is found. But I'ld like to change to ADO. I still don't know How to make application to be only ADO model. AFAIK, Form always return DAO recordset. This is why my application is hybrid.

    Sorry for long explanation, I hope you will understand. My english is not good.

    TIA
    Just remember one thing ... Using ADO there is a hard 6 sec delay for the writes to flush out (even with opening and closing the connection) ... This is documented. So if you take that into consideration of your design you shouldn't have any problems (requerying and such)...

  5. #5
    Join Date
    Nov 2003
    Posts
    28

    Re: Hybrid program problem (ADO + DAO)

    Originally posted by M Owen
    Just remember one thing ... Using ADO there is a hard 6 sec delay for the writes to flush out (even with opening and closing the connection) ... This is documented. So if you take that into consideration of your design you shouldn't have any problems (requerying and such)...
    Execuse me, Please tell me where is that documented ?

  6. #6
    Join Date
    Oct 2003
    Location
    US
    Posts
    343
    umm...well I use ADO and DAO alot and I've never seen such a thing. Looks like there is some problem in your code which is causing all this.

    You can try this. Update a record and check it shows correctly in the form. If it doesn't then close the form and then reopen. Keep doing it until it shows the updated information. If it does then it means somethings not right in your code, but if the information is not changed even after minutes of trying then we'll have to look somewhere else.

    See if you can post your app here and someone might take a look at it.

  7. #7
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    (...with ADO and it's multiple connections.....)
    Jet's read buffer has a five-second time-out, so changes made on one connection will not be visible on another for five seconds. In DAO, this was not an issue, because all objects were using the same buffer. The following Knowledge Base article provides more information on this topic, and how to share connections between data controls to eliminate the problems caused by multiple Jet sessions:

    http://support.microsoft.com/default...b;EN-US;216925
    izy
    currently using SS 2008R2

  8. #8
    Join Date
    Nov 2003
    Posts
    28
    Thank you everybody for your help.

  9. #9
    Join Date
    Jan 2004
    Posts
    184

    Re: Hybrid program problem (ADO + DAO)

    Try this control on download.com to make it 100% ADO without any effort:

    http://download.com.com/3000-2404-10...ml?tag=lst-0-1

    Originally posted by suntisuk
    Hello,

    I use AccessXP. My program is hybrid (ADO + DAO) to manipulate data in JET database and I found a lot of problems. This is one I would like to know :

    Due to my program is hybrid, if I add records to a table by using ADO and another form bound to query that is based on that table. That form will not be updated immediately although I force it to do by using form.Requery method. Actually, Sometime it does, sometime it not. I think this is because Access form read data in its own cache which is not up-to-date.

    Question is Does it have something I can do to force data in my ADO object to be flush to database AND force JET to refresh data from database into cache? (I think I have to do it both. Doing only one part might not guarantee. Now, I don't think by force form to Requery will help because form still get expired-data from cache. Force JET to do that should be the correct solving)

    Actually, If I use only DAO, no problem is found. But I'ld like to change to ADO. I still don't know How to make application to be only ADO model. AFAIK, Form always return DAO recordset. This is why my application is hybrid.

    Sorry for long explanation, I hope you will understand. My english is not good.

    TIA

Posting Permissions

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