Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

As each day passes I gain more insight into the functionality of asp.net and also loose some more hair from my temples from pulling at it in frustration. Programming is great! :D

 

Anyhew, I digress, this is an open question to all who know more than me, so nearly all members of this forum!

 

I need to return the last entry posted to a database and display the entry in a pretty fashion for the user. The key piece of data the user needs is the ID (autonumber) for the entry so they can record this somewhere else. Is there a way of returning to the user the last ID number added to the database? I remember reading something somewhere once (sorry for being vauge), which stated that this was possible, if this is the case that would be great.

 

Thanks for any help anyone can give. I am going to get back to pulling at my hair!

 

Thanks

 

Ash

Posted
I think your recalling the @@ID return value; this only works with SQL Server, with MS Access you need to set something up in the RowUpdated (maybe RowUpdating) event.
  • Moderators
Posted

It's @@IDENTITY, you would do something like this in your stored proc....

 

declare @myID int

SET @myID = 0

 

INSERT INTO myTable ......your columns here....

 

SET @myID = @@IDENTITY

 

return @myID

Visit...Bassic Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...