如何首先获得记录,最后进入 [英] how to get record first which has enterde in last

查看:80
本文介绍了如何首先获得记录,最后进入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,
我有一个包含某些数据的数据网格视图,我使用插入命令输入了一些新数据,我想在数据网格视图中获得该数据的第一行(即)后进先出

hi sir,
i have one data grid view with some of data iam enternig some new data using insert command i want get that data first row in data grid view (i.e) Last in First out

推荐答案

设置Table的主键,然后按Desc顺序获取记录,例如FIFO方法
set primarykey for Table andthen get records in orderby Desc is FIFO method for example
select * from table  order by ID  desc


假设您每次插入一条记录时都会增加主键,则只需按此键以降序获取所有记录即可.

Assuming you have a primary key that is incremented everytime you insert a record, you can simply fetch all records sorting by this key in descending order.

This will give you the last record first.


如果您正在使用的表有一个主键,并且它是整数,则在select命令中写查询以降序获取数据通过该主键.
否则,将一个日期时间添加到表中,然后在select命令中写查询以按该主键降序获取数据
If there is a primary key for the table you are using and it is integer then, in select command write query to fetch the data in descending order by that primary key.
Else add one date time to the table and in select command write query to fetch the data in descending order by that primary key


这篇关于如何首先获得记录,最后进入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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