|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
SQL statement to retrieve last two rows
Hey everyone!
I am writing a program in vb.net ! Using an oledbdataadapter i generate a dataset and display dataset records in a datagrid The user will be able to add new records to this datagrid which will update the database(access) upon the click on the update BUTTON when the user clicks update i get the number of row added if there are any now what i want to do is retrieve that last rows added from the same table! I.E. if there were two rows added to the datagrid, then i want to retrieve these two rows later for a reason! Is there an SQL statement to retrieve the last two records (rows) from a table in Access? pls help |
|
#2
|
||||
|
||||
|
If your table has a field, like an Id field, that automatically increments every time a record is added, you can do this:
SELECT TOP 2 * FROM Table1 ORDER BY Id Desc |
|
#3
|
||||
|
||||
|
hey pal!
thanks a lot for ur reply u really made my day! it works with my tablee THANK YOU |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > SQL statement to retrieve last two rows |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|