如何检索asp.net formview中的最后一行数据? [英] how to retrive the last row data in asp.net formview?

查看:85
本文介绍了如何检索asp.net formview中的最后一行数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我如何检索最后一行已使用FormView或Gridview添加到数据库中.

Hi
How i can retrieve the last row have been added to the database using FormView or Gridview

推荐答案

检查本文
check this article How to populate DataGridView, GridView with SQL statement in C#[^]

to get the last row of a table, I found I could do it like this: -

select * from articles order by artid desc limit 1;


它基本上以递减的artid顺序列出所有行,并且仅选择前1行(这是表中的最后一行,因为它是相反的).要获得倒数第二个:-



It basically lists all the rows in decreasing artid order, and only select the first 1 (which is the last row in the table as it's reversed). To get the second from last: -


select * from articles order by artid desc limit 1,1;


当给定limit两个参数时,它使用第一个数字作为偏移量,第二个数字作为要获取的行数.如果您愿意,可以说..... limit 0,8.获取所有最后8行.


when limit is given two params, it uses the first number as an offset, and the second number as the number of rows to get. If you wanted you could get all last 8 rows by saying .....limit 0,8.


这篇关于如何检索asp.net formview中的最后一行数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆