Results 1 to 5 of 5

Thread: Autoincrementing code record entry

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member divined's Avatar
    Join Date
    Aug 2004
    Location
    Thessaloniki, Greece
    Posts
    447

    Autoincrementing code record entry

    Hello everybody

    I have a table with just two fields. The first is an autoincrementing integer and the second a string (text).My DBMS is MySQL.
    Now, there is a form from which the user can enter a new record in the table. I would like the next autoincrement integer from the first field of the table to appear on the form. I thought of creating an ADO recordset object and fetching all records with a Select * Statement , thus counting all records. I believe that this approach will be time consuming.
    Does there exists an easier method?

    thx, in advance

    George Papadopoulos

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173
    SELECT COUNT(*) FROM Tablename

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173
    Or better:

    SELECT MAX(PrimaryKeyID) FROM TableName

  4. #4

    Thread Starter
    Hyperactive Member divined's Avatar
    Join Date
    Aug 2004
    Location
    Thessaloniki, Greece
    Posts
    447

    Talking

    well, thx

    I guess it comes easy when you`re into this stuff for some time!

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173
    Indeed. Practice makes Mendhak.



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