Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a table in which several fields are available, A person can fill the record many time, and in the id field i have guid, that will be generated by the user as he fill the record. Now I want to show the latest GUID on the next page.
How can i do.
Posted
Comments
Nandakishore G N 19-May-14 1:03am    
Use record addeddate or CreatedDate as Abhinav said and include in fetching query 'order by yourdatecolumn desc'...Better paste your table structure...

Have some kind of information, example last modified date etc, on which you can sort this data.
Alternately, if you are storing this information in the database, sort by the primary key in descending order.
 
Share this answer
 
You can do it By Primary key order by desc and using @@IDENTITY

1)

SQL
SELECT TOP 1 id FROM TABLENAME ORDER BY DESC


2)

SQL
INSERT INTO (.............)
SELECT @@IDENTITY


Here you can get latest inserted id of a table
 
Share this answer
 
insert identity number or created date and assign order by this column in desc
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900