943,678 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 516
  • C# RSS
Nov 11th, 2008
0

hi

Expand Post »
i want to retrieve last record in database with out doing ascending or decending order...can anyone tell me what query for this?
Reputation Points: 3
Solved Threads: 0
Junior Poster
sivak is offline Offline
132 posts
since Nov 2008
Nov 11th, 2008
0

Re: hi

Why?
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Nov 11th, 2008
0

Re: hi

Put a timestamp field in your table and use a query to get the record with the most recent timestamp.
Reputation Points: 2023
Solved Threads: 644
Senior Poster
ddanbe is offline Offline
3,736 posts
since Oct 2008
Nov 11th, 2008
0

Re: hi

either timestamp or as long as you are doing inserts with an autoincrementing id

C# Syntax (Toggle Plain Text)
  1. select * from table where idcolumn = max(idcolumn)
Last edited by dickersonka; Nov 11th, 2008 at 11:14 pm.
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Nov 12th, 2008
0

Re: hi

hi
u can use this way also
Quote ...
select max(id) from tablename
if u r insert records automatic way or(autogenerate id) means this is useful
Reputation Points: 10
Solved Threads: 23
Junior Poster
Renukavani is offline Offline
123 posts
since Jul 2008
Nov 12th, 2008
0

Re: hi

thats what i wrote, he said record, thats why i selected the whole row
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Unable to update table
Next Thread in C# Forum Timeline: Making a tetris game.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC