开发者

how to display the records from gridview which is latest record show on first row

开发者 https://www.devze.com 2023-04-01 06:17 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消