datagrid如何统计列,我的分散完了,最后剩10分了,希望没分大家也可以帮忙看看
像下面的程序里如何统计CHARGE这一列,并把它单独用一行显示在datagrid里。我的分散完了,最后剩10分了,希望没分大家也可以帮忙看看
void BindGrid()
{
String ls_month = Request[ "ls_month "];
String phone = Session[ "phone "].ToString();
String strConnection = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE= " + Server.MapPath( "local.mdb ") + "; ";
String strSQL = "select ACCT_ITEM_TYPE_NAME,CHARGE from ACCT_ITEM,ACCT_ITEM_TYPE_GL,BILLING_CYCLE where ACCT_ITEM.ACCT_ITEM_TYPE_ID=ACCT_ITEM_TYPE_GL.ACCT_ITEM_TYPE_ID and ACCT_ITEM.SERV_ID= " + phone + "and BILLING_CYCLE.BILLING_CYCLE_ID=ACCT_ITEM.BILLING_CYCLE_ID and month(BILLING_CYCLE.MONTH)= " + ls_month;
DataSet objDataSet = new DataSet();
OleDbConnection objConnection = new OleDbConnection(strConnection);
OleDbDataAdapter objAdapter = new OleDbDataAdapter(strSQL, objConnection);
objAdapter.Fill(objDataSet, "CHARGE ");
DataView objDataView = new DataView(objDataSet.Tables[ "CHARGE "]);
MyDataGrid.DataSource = objDataView;
MyDataGrid.DataBind();
}
------解决方案--------------------DataSource里增加一行,自己设置行内容
------解决方案--------------------DataGrid1.Columns.Count;返回列数