Which of these question do you mean?
A) How do I get the last row in a DB table using ASP.NET?
or
B) How do I get the last row INSERTED INTO a DB table using ASP.NET?
A) The database objects used in .NET are much more powerful than those used in ASP (ADODB). There are many ways to answer the first question.
B) This is a completely different situation. There is no built it way to ask the database for "the last inserted row". You would need to figure that out based on the data within. If you use an identity field in the table, than you could ask for the row with a simple query:
select * from table where rowid=(select max(rowid) from table)
Or it could be based on date if you have a date field...
select * from table where CreateDate=(select max(CreateDate) from table)
This is all up to how your data is stored.
Peter
------------------------------------------------------
Work smarter, not harder.
|