data table field value count

Posted by Sekar.C under C# on 3/9/2012 | Points: 10 | Views : 4370 | Status : [Member] | Replies : 1
hi,
In my data table have 3 fields( Name, Deviation, Image) in the Deviation display numeric values I want number of time 0 values display.
attached my sample data table
regard
sekar.c

Regards
Sekar.c



Responses

Posted by: Hmanjarawala on: 3/9/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Use DataTable.Compute(string expression, string filter);

ex:

DataTable dt = new DataTable();
dt.Columns.Add("Value", typeof(double));

dt.Rows.Add(new object[] { 39.56 });
dt.Rows.Add(new object[] { 23.56 });
dt.Rows.Add(new object[] { 0 });
dt.Rows.Add(new object[] { 14.89 });
dt.Rows.Add(new object[] { 0 });
dt.Rows.Add(new object[] { 0 });
dt.Rows.Add(new object[] { 0 });

var count = dt.Compute("Count(Value)", "Value=0");



Mark this as answer, if it helps you............

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response