Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6016291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:57:41+00:00 2026-05-23T02:57:41+00:00

Need advice on what is the best approach to get the auto incremented id

  • 0

Need advice on what is the best approach to get the auto incremented id to be the same on multiple forms.

Basically I am using VB .Net with SQL Server as the backend. I wrote a few stored procedures to insert data and then I am calling the stored procedures on the front end. I have 3 forms and once the first form is submitted it generates an autoID and then takes the user to 2nd form.

In the second form I have a separate insert stored procedure is there a way to grab the id that the first form generated and for it to be consistent. Or should I store it in a variable after they submit the form and then call it in the second form.

I read about the @@Identity but that only grabs the id within that session since I am submitting the first forms data then going to the second wouldn’t that be a different session.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:57:42+00:00Added an answer on May 23, 2026 at 2:57 am

    Your stored proc could return the identity value (use the output clause or scope_identity() to get it) as an output variable that you would store as a variable in your application, then it would be available to use. You would want to make sure to null out the varaible when the person moves to a differnt record and after allthe associated formas have inserted records, so that you don;t inadvertently use it at some other time.

    You do not want to ever use @@identity for this as it is unreliable and can create massive data integrity issues as it will give you the wrong value if someone adds a trigger that inserts to another table with an identity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need some advice about a best-approach for this problem: I've fallen madly in love
I need some advice for the best approach to use in developing embeddable widgets
I need some advice on the best approach to take for the following. I
Need some best practice advice here... Navigation based application. Root view is a UITableView
I need advice on using stored procedures with Entity Framwork 4.x to return data
I have 3 tables, I need advice on how to get data from them.
What's the best approach to provide URL handling in an ASP.NET application to produce
I wanted your advice for the best design approach at the following Python project.
I need advice on the following HTML: <!-- Beginning of ROW !--> <div id="row1">
I need advice on how to change the file formatted following way file1: A

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.