I can not get the right result from the following code block:
object ob = ds_bug.Tables[0].Compute("Count(id)",str_vertical +"= '"+"' and "+str_horizontal+" = '"+first_row.Cells[j].Text.ToString()+"'");// ds_bug has been filled some data.
str_vertical and str_horizontal are two fields from the ds_bug.Tables[0], and I can see their values are right too when I debug the code.
Is there any problem I set the filter with a string like ” a = ‘##’ and b = ‘##’ ” ?
First you should split the method call and the initialization of the expression and the filter, that makes it clearer:
I assume that
first_row.Cells[j].Text.ToString()is a static value that you’ve queried previously, so you can declare it like: