Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 8th, 2005, 06:15 PM
Registered User
 
Join Date: Dec 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Get the ID generated from the previous INSERT oper

Get the ID generated from the previous INSERT operation.

In php this is called mysql_inset_id(); i was wondering if asp has somthing like this.



 
Old December 8th, 2005, 07:25 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Do you suppose you could spare more than 24 words to explain what it is that you are trying to do?
Database INSERT?
Which database management system then (if so)?
What is the intended use of what it is that you are trying to get?
And so on.
 
Old January 11th, 2006, 06:41 PM
Registered User
 
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In MSSQL you can use "SELECT @@IDENTITY AS LastID"
Or use "SELECT MAX(ID) AS LastID FROM Table"

 
Old January 11th, 2006, 07:13 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

That would work, here is another way to skin the same cat:

sql = "SELECT TOP 1 [idFieldName] FROM [tbleName] ORDER BY [idFieldName] DESC;"

BTW: Use trailing semi colons at the end of your SQL. This is not required but very Recommended. This explicitly terminates the statement and helps prevent SQL injections:

TIP: Place your sql language posts in the SQL area of the forum for the best possible solution.

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the LAN ID and insert into database ? kutel ASP.NET 2.0 Professional 1 August 15th, 2007 03:51 AM
auto generated mail id vijaypalada ASP.NET 1.0 and 1.1 Basics 2 January 20th, 2007 05:50 PM
Get ID from Labels that are dynamically generated bekim Javascript How-To 6 February 20th, 2006 04:52 AM
get recordet id after insert keyvanjan Classic ASP Databases 5 May 14th, 2005 05:15 AM
Insert new record ID levinho Classic ASP Databases 5 January 14th, 2004 12:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.