how to display the records from gridview which is latest record show on first row
I have small appl开发者_JS百科ication which uses a gridview. In that, when we insert the records into the database which is current that record show in first row of the gridview. Please tell me how?
if you have a primary key auto increment or an insert datetime in your table, you can query the database with a ORDER BY ID DESC
or ORDER BY INSERTDATE DESC
at the end of the select command.
Another way could be to use the BindingSource.Sort property. Enter the column name and "desc" if needed.
MSDN documentation of Sort property
精彩评论