如何按时间列出datagrid中的数据 [英] how to list data in datagrid on time basis

查看:88
本文介绍了如何按时间列出datagrid中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个论坛应用程序,该应用程序在数据库中使用两列(描述和创建日期).现在我要一一显示描述列的插入数据,即先显示先前的数据,然后显示随后的一个,并应在datagrid中继续执行相同的操作.

帮助我..

I''m doing a forum application which is using two columns (description and created date)in database. Now I want to display inserted data of description column one by one i.e, previous data first then later one and should continue same thing in datagrid.

help me out..

推荐答案

使用datecolumn来显示记录降序排列,例如

按desc从表名顺序中选择*
Use datecolumn for displaying records descending order like

Select * from tablename order by desc


只需添加列ID并将其设置为身份规范yes,然后将其递增1.

然后将sql查询写为

按ID升序从表名顺序中选择*.

如果您必须显示选定的记录,请使用

按ID升序从表名顺序中选择top(5)*.
Just add a column ID and set its is identity specification yes and increment it by 1.

then write sql query as

select * from tablename order by id asc.

if u have to show selected records then use

select top(5)* from tablename order by id asc.


这篇关于如何按时间列出datagrid中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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