Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 12th, 2004, 11:50 AM
Registered User
Join Date: Aug 2004
Location: , , USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Assigning Record IDs

Hello. I am working on an application that will allow users to create new entries for an accounting database. How do I go about having the program assign each entry a record ID after the user clicks the submit button?

Any help is greatly appreciated. Thanks.

--DK Spivey
Reply With Quote
  #2 (permalink)  
Old November 12th, 2004, 12:39 PM
Friend of Wrox
Join Date: Jul 2003
Location: York, , United Kingdom.
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts

If you're adding records using a stored procedure, the @@IDENTITY variable will give you the last identity added to a table, for example:

        @jobDesc varchar(50)
        @min_lvl int
        @max_lvl int
INSERT INTO jobs (job_desc,min_lvl,max_lvl)
VALUES (@jobDesc,@min_lvl,@max_lvl)

If you execute a scalar against this, it will return the new identity

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ids dhoward VB.NET 2002/2003 Basics 4 December 17th, 2007 05:46 PM
Email IDs rohit_ghosh Excel VBA 2 July 16th, 2007 03:57 PM
Dialog Help Ids sumeetpm Visual C++ 0 October 31st, 2006 03:19 PM
Duplicating IDs in database pettrer ASP.NET 2.0 Basics 7 July 8th, 2006 04:03 PM
Ids problem on subform ailyn Access VBA 1 December 9th, 2005 05:30 PM

All times are GMT -4. The time now is 02:49 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.