Psst! Did you know DevelopmentNow is a mobile web site design agency?

Contact us for help mobilizing your site, or to sign up for our beta Mobile Web SDK!
all groups > c# > january 2010 >

c# : Finding Min and Max value of Column in Dataset


Dan
1/21/2004 6:06:07 PM
I have the following code that executes a parameterized Query and pupulates the data in a datagrid. All is good. My problem is I would now like to get the minimum and maximum value of one of the columns. My code that works is:

public void button2_Click(object sender, System.EventArgs e)
{
dataSet21.Clear();
this.oleDbSelectCommand2.Parameters["StartKey"].Value = textBox2.Text;
int myEndKey = int.Parse(textBox2.Text);
this.oleDbSelectCommand2.Parameters["EndKey"].Value = myEndKey + 64;
oleDbDataAdapter2.Fill(dataSet21);
William Ryan
1/21/2004 11:17:27 PM
Dan:

The DataTable.Compute method supports Expressions and I'm 99% sure Max and
Min are supported. Typically, it'd be something like
MyDataTable.Comupte("MAX(ColumnValue)", "ColumnValue >= 0")
[quoted text, click to view]
pupulates the data in a datagrid. All is good. My problem is I would now
like to get the minimum and maximum value of one of the columns. My code
that works is:
[quoted text, click to view]

dsfsfsdf
1/9/2010 2:39:30 AM
fdsfdffs

From http://www.google.co.in/url?sa=t&source=web&ct=res&cd=2&ved=0CA4QFjAB&url=http://www.developmentnow.com/groups/post.aspx?newsgroupid=36&threadid=205541&rct=j&q=MyDataTable.Comupte("MAX(ColumnValue)",+"ColumnValue+>=+0")&ei=qFxIS8yJNYuTkAWpu6n3Ag&usg=AFQjCNEGcbv9jTjkjSo7mM_2B30wKs8SyA

Posted via DevelopmentNow.com Groups
AddThis Social Bookmark Button