好吧,我从数据表中获得了这些数据:
Recom House 49
Recom Street 47
Recom Floor 29
Area House 5
Area Floor 1
Observ Floor 1
但我想要这样的东西:
Recom House 49
Recom Street 47
Recom Floor 29
Area House 5
**Area Street 0**
Area Floor 1
**Observ House 0**
**Observ Street 0**
Observ Floor 1
我不能从存储过程中做到这一点,所以我正在尝试代码隐藏,但我真的不知道,我尝试了一些东西,但它不起作用,而且不是最好的解决方案。
int getTotal = ((from a in dtSerieDrill.AsEnumerable()
where a.Field<int>("idTipoRevision") == Int32.Parse(dtSerie.Tables[0].Rows[i]["idTipoRevision"].ToString())
select a.Field<string>("TipoRevision")).Distinct()).ToArray().Length;
if (getTotal == arrayCat.Length)
{
auxData += "{";
auxData += "name:'" + dtSerieDrill.Rows[n]["TipoRevision"].ToString() + "',";
auxData += "y:" + Double.Parse(dtSerieDrill.Rows[n]["Total"].ToString()) + "";
auxData += "},";
} else {
for (int g = 0; g < arrayCat.Length - 1; g++)
{
arrayCat //categories(house,street,floor,etc)
if (!arrayCat[g].Equals(dtSerieDrill.Rows[n]["Especialidad"].ToString()) && !(totalAux == (g+1)))
{
auxData += "{";
auxData += "name:'" + arrayCat[g] + "',";
auxData += "y:0";
auxData += "},";
break;
} else {
auxData += "{";
auxData += "name:'" + dtSerieDrill.Rows[n]["TipoRevision"].ToString() + "',";
auxData += "y:" + Double.Parse(dtSerieDrill.Rows[n]["Total"].ToString()) + "";
auxData += "},";
break;
}
}
}
我有那个代码,因为我会将它用于脚本。我可以添加带有空“总计”的行或创建一些