在数据集中的列中找到最大值 [英] find greatest value in a column in dataset

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

问题描述

如何使用asp.net和c#

How can I find the greatest value of a column in dataset using asp.net and c#

推荐答案

找到数据集中列的最大值。参考:

1。 max-value-in-datatable-column-c-sharp [ ^ ]

2. 如何-to-find-a-column-in-a-a-datatable [ ^ ]
Refer:
1. maximum-value-in-datatable-column-c-sharp[^]
2. how-to-find-max-value-of-a-column-in-a-datatable[^]




我这可能对你的问题有所帮助。



十进制最大值= Math.Max(Convert.ToDecimal(ds.Tables [2] .Compute( MAX(AccountLevel),)。ToString()),Math.Max(Convert.ToDecimal(ds.Tables [0] .C ompute( 最大(AccountLevel), )。的ToString()),

Convert.ToDecimal(ds.Tables [1] .Compute( 最大(AccountLevel), )。 ToString()));
Hi,
I this may help for ur question i think.

decimal max = Math.Max(Convert.ToDecimal(ds.Tables[2].Compute("MAX(AccountLevel)","").ToString()), Math.Max(Convert.ToDecimal(ds.Tables[0].Compute("Max(AccountLevel)","").ToString()),
Convert.ToDecimal(ds.Tables[1].Compute("Max(AccountLevel)","").ToString()));


有很多方法可以做到这一点,使用dataview,LINQ等:

在这里你可以看到我的程序样本:



There is lot of ways to do this,Using dataview,LINQ and etc :
here you can see my program sample :

DataView dvDateDisplay = new DataView(ds.Tables[0]);                                          dvDateDisplay.RowFilter = "CustName ='" + CustName + "'";
                  if (dvDateDisplay.Count > 0)
                    {
     String YDATES = dvDateDisplay.ToTable().Compute("Max(YDATE) ", String.Empty).ToString();
          }





您可以通过更多示例查看更多链接:



http://stackoverflow.com/questions/4460941/dataset-compute-最大值 [ ^ ]



http://stackoverflow.com/questions/2442525/how-to-select-min-and-max-values-of-a-column-in-a-datatable [ ^ ]





http://stackoverflow.com/questions/16009628/how-to-find-max-val数据表中的列数[ ^ ]







http:// www .dotnetlines.com / forum / tabid / 86 / forumid / 2 / threadid / 102 / scope / posts / Default.aspx [ ^ ]



you can check more links here with more examples :

http://stackoverflow.com/questions/4460941/dataset-compute-max-value[^]

http://stackoverflow.com/questions/2442525/how-to-select-min-and-max-values-of-a-column-in-a-datatable[^]


http://stackoverflow.com/questions/16009628/how-to-find-max-value-of-a-column-in-a-datatable[^]



http://www.dotnetlines.com/forum/tabid/86/forumid/2/threadid/102/scope/posts/Default.aspx[^]


这篇关于在数据集中的列中找到最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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