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. General Programming
  3. Visual Basic
  4. For DB experts only!

For DB experts only!

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestion
3 Posts 3 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.
  • L Offline
    L Offline
    lee1212
    wrote on last edited by
    #1

    Hi This is not a regular problem but still any one who know the answer is bigger then life. Let say we have an access database file (mdb) with one table that called tblRecID with 2 fields: "RecID" & "Info". "RecID" is auto number + Primery key + Index. "Info" is simple text. If we saved 2 records to this table then the next "RecID" will be 3. Now let's delete the 2 records and the table is now empty again. How can you get the current "RecID" that need to be 2 (for now) by code (maybe DataTable object) ? Any one?

    R P 2 Replies Last reply
    0
    • L lee1212

      Hi This is not a regular problem but still any one who know the answer is bigger then life. Let say we have an access database file (mdb) with one table that called tblRecID with 2 fields: "RecID" & "Info". "RecID" is auto number + Primery key + Index. "Info" is simple text. If we saved 2 records to this table then the next "RecID" will be 3. Now let's delete the 2 records and the table is now empty again. How can you get the current "RecID" that need to be 2 (for now) by code (maybe DataTable object) ? Any one?

      R Offline
      R Offline
      Richard Day
      wrote on last edited by
      #2

      lee1212 wrote: How can you get the current "RecID" that need to be 2 (for now) by code (maybe DataTable object) ? I'm with you right up until this sentence. Please can you clarify.

      1 Reply Last reply
      0
      • L lee1212

        Hi This is not a regular problem but still any one who know the answer is bigger then life. Let say we have an access database file (mdb) with one table that called tblRecID with 2 fields: "RecID" & "Info". "RecID" is auto number + Primery key + Index. "Info" is simple text. If we saved 2 records to this table then the next "RecID" will be 3. Now let's delete the 2 records and the table is now empty again. How can you get the current "RecID" that need to be 2 (for now) by code (maybe DataTable object) ? Any one?

        P Offline
        P Offline
        pxw
        wrote on last edited by
        #3

        There is a SQL statement for setting "IDENTITY_INSERT" on or off. With it on, you can insert any legimate value you desire (it can't be a duplicate to what is there). When you are done, turn it back off. syntax SET IDENTITY_INSERT [ database. [ owner. ] ] { table } { ON | OFF } but you need either "owner" or "dba" the rights to the database.

        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