System.data.datarow不包含defenition ...... [英] System.data.datarow does not contain defenition......

查看:63
本文介绍了System.data.datarow不包含defenition ......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iam使用数据表将值绑定到实时图表

iam using a datatable bind the values to live chart

DataTable dtcombo = new DataTable();
dtcombo = objG.GraphReport();

 var datas = dtcombo.AsEnumerable();
                                ColumnSeries col = new ColumnSeries() { DataLabels = true, Values = new ChartValues<int>(), LabelPoint = Point => Point.Y.ToString() };
                                Axis ax = new Axis() { Separator = new Separator() { Step = 1, IsEnabled = false } };
                                ax.Labels = new List<string>();
      
                                        foreach (var x in  datas)
                                        {
                                            col.Values.Add(x.particulars.ToString());
                                            ax.Labels.Add(x.year.ToString());

                                        }





但在这些位置显示错误



but shows a error at these position

col.Values.Add(x.particulars.ToString());
 ax.Labels.Add(x.year.ToString());





显示system.data.datarow不包含辩护.....



任何人都知道请帮助我...



我尝试过:



尝试将数据转换为列表



its shows system.data.datarow does not contain defenition.....

anybody knows please help me...

What I have tried:

tried datatable converted to list

推荐答案

DataRow对象不包含每个列的属性:您需要通过索引访问teh列:

DataRow objects do not contain properties for each of your columns: you need to access teh column via an index:
col.Values.Add(x[0].ToString());

或按名称:

col.Values.Add(x["particulars"].ToString());


这篇关于System.data.datarow不包含defenition ......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆