Find the Last inserted Auto increment ID in MYSQL with ASP

3
Share This:

It’s taken me ages to find out how to do this (what turns out to be a) relatively simple operation.

Here’s the problem. Table 1 has a user_id which is auto incremented by MYSQL. Table 2 has an auto incremented login_id but also requires the user_id. Here’s how we get one ID from one table to the other:

How Do Paid Online Surveys Work?
If you're looking to expand your business in the New Year then you'll need to know what direction to take and surveys are a great way to find out what your customers are looking for. While you can set up a free survey on a variety of platforms, if you...
How To Have The Most Organized Christmas In Half The Time
During this season we are admiring every moment. Reflecting on the past year, thinking about what we are thankful for and cherishing these festive times with loved ones. To get to these unforgettable times, there are several steps it takes to get there. Some people begin preparing for the holidays...
From Passion To Profit

objRS.source = “Select LAST_INSERT_ID() from Table1”
objRS.open
LastID = objRS(“LAST_INSERT_ID()”)
objRS.Close

Simple! We can then refer to the LastID in Table 2

blank
About The Author
Katy is always trying to be more productive one day at a time! Whether it's analogue, digital, motivational or psychological who'll try any system that will help her get things done and get organised. As well as running FlippingHeck.com, she also loves making music and reviewing things.
  • Follow Katy Whitton on:
  • blank
  • blank
  • blank
  • blank
  • blank
  • blank
  • blank
  • blank
Please Note: This post may contain affiliate links. By clicking on these links you will not be charged any extra for purchasing goods and services from our preferred partners however flippingheck.com may receive financial compensation which contributes to the running of the site. For more information please read our Advertising & Affiliate Disclosure Policy

3 thoughts on “Find the Last inserted Auto increment ID in MYSQL with ASP

  1. “Could do, but if someone else was updating the recordset at the same time apparently it could get a bit screwey, there’s several ways of doing it.”

  2. I have been surfing for mire than three hours today, and
    i’m yet to find a page like yours. It has made my effort online worth while.
    In my view, if all site owners andd bloggers
    prodcuced good content like this, the webb would
    be a ore useful resource.

Leave a Reply

Your email address will not be published. Required fields are marked *