数据添加到DataTable

DataTable tblDatas = new DataTable("Datas");
            DataColumn dc = null;
           
            dc = tblDatas.Columns.Add("Title", Type.GetType("System.String"));
            dc = tblDatas.Columns.Add("Order", Type.GetType("System.String"));
            dc = tblDatas.Columns.Add("DanWei", Type.GetType("System.String"));
            DataRow newRow;
            newRow = tblDatas.NewRow();
            newRow["Title"] = "成功付款大订单";
            newRow["Order"] = resultFinancialControllerImpl.getOrderChengGong(fc["Lottery"], fc["issue"]); //大订单成功数
            newRow["DanWei"] = "单位";
            tblDatas.Rows.Add(newRow);

            newRow = tblDatas.NewRow();
            newRow["Title"] = "成功配送单";
            newRow["Order"] = ViewData["DistributionChengGong"] = resultFinancialControllerImpl.getDistributionChengGong(fc["Lottery"], fc["issue"]); // 配送单成功单
            newRow["DanWei"] = "单位";
            tblDatas.Rows.Add(newRow);


            List<StatisticAnalysisInfo> list = new List<StatisticAnalysisInfo>();
            StatisticAnalysisInfo sta;
            DataSet ds = new DataSet();
            ds.Tables.Add(tblDatas);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                sta = new StatisticAnalysisInfo();
                sta.Title = ds.Tables[0].Rows[i]["Title"].ToString();
                sta.Order =decimal.Parse(ds.Tables[0].Rows[i]["Order"].ToString());
                sta.DanWei = ds.Tables[0].Rows[i]["DanWei"].ToString();
                list.Add(sta);
            }
            ViewData.Model = list;

数据添加到DataTable

上一篇:Geolocation获取地理位置


下一篇:常用脚本--在线重建或重整实例下所有索引