从数据集中检索单行 [英] retrive single row from dataset

查看:70
本文介绍了从数据集中检索单行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从数据集中检索最后一行到第二行和第三行

  var  lastUploaded = ds。表[  title]。AsEnumerable()。OrderByDescending(r = >  r.Field(  video_id))。(< span class =code-digit> 3 ); 

解决方案

请遵循以下代码,我确信它给出了你想要的结果---



  //  以下行为您提供最后一行 -   

ds.Tables [ < span class =code-string> title]。行[ds.tables [ title ]。rRows.count-2] [ 你的专栏名称他重新]的ToString();

// 类似以下行给出最后一行 -

ds.Tables [ title]。行[ds.tables [ title]。rRows.count-3] [ 你的Colum名称在这里]。ToString();



等等。 ........


I want to retrieve last to second and third row from dataset

var lastUploaded = ds.Tables["title"].AsEnumerable().OrderByDescending(r => r.Field("video_id")).Take(3);

解决方案

Follow the following code and i am sure it gives you the desired result---

//The following line gives you the last 2nd row--

ds.Tables["title"].Rows[ds.tables["title"].rRows.count-2]["Your Column name here"].ToString();

//Similarly The following line gives you the last 3rd row--

ds.Tables["title"].Rows[ds.tables["title"].rRows.count-3]["Your Colum name here"].ToString();


and so on.........


这篇关于从数据集中检索单行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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