Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. problem in adding records after deleting some records

problem in adding records after deleting some records

Scheduled Pinned Locked Moved Database
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Wormhole5230
    wrote on last edited by
    #1

    Hi, I have a problem in listing all records in my mdb file. steps. 1. I made a mymdb.mdb file. 2. added some records. 3. deleted some records. 4. added new records. 5. repeat 2,3,4 steps several times. Finally, when I list all the records in mdb file - I used MoveFirst(), read record and MoveNext() until all the records were populated. - the added records in 4th step were inserted somewhere near the deleted records in 2nd step. I don't know exactly this behavior is caused my code or it is a nature of mdb. I want to place the new records always in the last of the mdb. How can I do that? Thanks.

    H 1 Reply Last reply
    0
    • W Wormhole5230

      Hi, I have a problem in listing all records in my mdb file. steps. 1. I made a mymdb.mdb file. 2. added some records. 3. deleted some records. 4. added new records. 5. repeat 2,3,4 steps several times. Finally, when I list all the records in mdb file - I used MoveFirst(), read record and MoveNext() until all the records were populated. - the added records in 4th step were inserted somewhere near the deleted records in 2nd step. I don't know exactly this behavior is caused my code or it is a nature of mdb. I want to place the new records always in the last of the mdb. How can I do that? Thanks.

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      Wormhole5230 wrote: I don't know exactly this behavior is caused my code or it is a nature of mdb this is a nature of any DBMS.. you have no control over the physical order of records in a datafile..(Unless you make a clustered index in sql server but event in this case i'm not sure about the order)Access and SQL Server fill the space marked for deletion with new records.. need a solution ? add an Autonumber field and let your queries end with (Order By ID) ;P

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups