A database problem i have encountered

the problem i have been having is the order in which records are being output.. i use objRS.MoveFirst and from there i keep using MoveNext in a loop, writing the records i encounter. However, somehow, records get displaced... and consistantly too. For example, if you go to www.cgalliance.net and look at the dates on the news posts.. you will see that the title 'ECTS' should be below 'WarCraftIII Gameplay Video'. It isnt the only instance either. When i open the database in Access, the news posts are in the order they should be.

Has anyone encountered this? Does anyone have a solution?

(it happens with more than just the news)

Comments

  • This problem is commonly found where you happen to delete something from the database in-between the MoveFirst and MoveNext statements. This was due to a bug in MDAC 2.1, which was corrected in MDAC 2.1 SP2. Although this seems to be highly unlikely in your case, do check it.

    Whatever be the cause of the problem, as for the solution, there can be many - like using "BookMarks" in the database, or displaying (after verifying) the records on basis of their Record Numbers, and not just because MoveNext returned them.

    I can detail you on the above methods if you want.


    Manish.



  • It would appear that when i delete a record from the middle of the table, and then add a new record... the new record replaces (ie, goes into the old location of) the deleted one.

    I dont know how i am gonna fix the problem.. maybe i will change the delete record code so it shifts the records up by 1 and then deletes the end record (edit one record to be the one above it, and keep doing that all the way up till you hit and end record). That way i wont be compromising on performance.. since i wont be deleting too many records. But we will see. Any suggestions are welcome.


    btw.. Thanks for your reply Manish


  • I think there was a documented method to do what you want to do. I'm sorry I don't remember exactly the method or the location - but there does exist one.

    Another workaround perhaps revolves around using the BookMarks in RecordSets. try reading more on that.

    Good Luck!


    Manish.



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories