Home > Net >  Do it after DATAGRIDVIEW in binding data statistics
Do it after DATAGRIDVIEW in binding data statistics

Time:11-30

I am then sum by filling in the data, but do not know why now sum the result is 0,


 
String sql_str="SELECT online distribution order result table. Order industry as a result, online distribution order result table. KuoXiao amount as a result, online distribution order result table. The order number" +
"FROM the online distribution order result table INNER JOIN megabite dimension result table name list ON the online distribution order. Order megabite results=megabite dimension names table. Dimensions industry" +
Name of "UNION ALL SELECT supermarket stores, supermarkets KuoXiao amount, supermarket order number FROM the online distribution order table supermarket results";

CMD=new OleDbCommand (sql_str, conn);
Conn. The Open ();
Find_do=new OleDbDataAdapter ();
Find_do. SelectCommand=CMD;
Ds=new DataSet ();
Find_do. The Fill (ds, "rs");
Conn. Close ();
DataTable DataTable=ds. The Tables (" rs ");
Int ab=0;
DataGridViewRowCollection rows=this. D_xs2. Rows;

Foreach (DataGridViewRow row in rows)
{
Ab +=the Convert. ToInt32 (row) Cells [1]. The Value).
}

DataRow dataRows.
DataRows=dataTable. NewRow ();
DataRows [0]="combined";
DataRows [1]=ab;
The dataTable. Rows. The Add (dataRows);
Enclosing d_xs2. The DataSource=dataTable;
  •  Tags:  
  • C#
  • Related