Sum of a result of a SQLDataSource

0

I'm developing a report system for link control and I need to get the result of a query and make a summation that brings me the total number of links per sector of a given number.

I'm using Stored Procedure with MySQL database and development is in ASP.Net. I'm trying this way.

I declare the variables getting zero:

Double TotalLigacoes, TotalSetor, TotalSac, TotalProjetos, TotalTI, TotalADMINISTRATIVO, TotalComercial, TotalDiretoria, TotalRecepcao, TotalOutros = 0;

protected void GvSetor_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if(e.Row.Cells.[0].text == "ADMINISTRATIVO")
    {
        TotalADM = TotalADM + Convert.ToDouble( TotalADM + e.Row.Cells[1].Text);
    }
}

I have to do something like a looping to add the minutes of 'SqlDataSource' and add it to a variable to display on the other grid.

    
asked by anonymous 20.02.2014 / 20:55

1 answer

2

TotalADM = TotalADM + Convert.ToDouble( TotalADM + e.Row.Cells[1].Text);

With this you are adding TotalADM twice. Here's how:

TotalADM += Convert.ToDouble(e.Row.Cells[1].Text);

    
20.02.2014 / 20:57