在图表中显示错误 [英] in the chart shows the error

查看:91
本文介绍了在图表中显示错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

sql =选择不同的r.rate作为Rate,f.bfid作为BFid FROM bthfac AS f,批处理b,facfeedback r;

sql = sql +where month(b.examdate )=''+ Ddlmonth.Text +''和year(b.examdate)=''+ DropDownList2.Text +''和;

sql = sql +r。 bfid = f.bfid和b.bthid = f.bthid和f.facid =''+ DropDownList4.SelectedValue +'';

dr = scon.ReadSql(sql);

GridView3.DataSource = dr;

GridView3.DataBind();

GridView3.Visible = true;





//在图表中显示该代码的gridview记录如下



dr = scon.ReadSql(sql);

int [] LRate = new int [GridView3.Rows.Count];

int [] LBFid = new int [GridView3.Rows.Count];

int i = 0;

while(dr.Read())

{

LRate [i] = int.Parse(dr [0] .ToString());

LBFid [i] = int.Parse(dr [1] .ToString()) ;

Chart1.Series.Add(LBFid [i] .ToString());

i = i + 1;

}





在运行模式下执行时显示错误如下;





:''SeriesCollection''中已经存在名为''65'的图表元素。



有什么问题我上面的代码。



请你好p me。





注意它是使用asp.net使用c#的web应用程序。



问候

Narasiman P.

sql = "select distinct r.rate as Rate,f.bfid as BFid FROM bthfac AS f,batch b,facfeedback r";
sql = sql + " where month(b.examdate)= ''" + Ddlmonth.Text + "'' and year(b.examdate)= ''" + DropDownList2.Text + "'' and ";
sql = sql + " r.bfid=f.bfid and b.bthid=f.bthid and f.facid = ''" + DropDownList4.SelectedValue + "''";
dr = scon.ReadSql(sql);
GridView3.DataSource = dr;
GridView3.DataBind();
GridView3.Visible = true;


//Displaying the gridview records in the chart for that code as follows

dr = scon.ReadSql(sql);
int[] LRate = new int[GridView3.Rows.Count];
int[] LBFid = new int[GridView3.Rows.Count];
int i = 0;
while (dr.Read())
{
LRate[i] = int.Parse(dr[0].ToString());
LBFid[i] = int.Parse(dr[1].ToString());
Chart1.Series.Add(LBFid[i].ToString());
i = i + 1;
}


in the run mode when i execute shows error as follows;


:A chart element with the name ''65'' already exists in the ''SeriesCollection''.

what is the problem in my above code.

please help me.


Note it is web application using asp.net using c#.

Regards
Narasiman P.

推荐答案

我认为这是这部分:



I think it''s this part:

Chart1.Series.Add(LBFid[i].ToString());





尝试添加一个具有相同名称的元素。

在将其添加到Collection之前,您应该检查是否已有一个具有该Name的元素。



Is trying to add an element with the same name.
You should check if there is already an element with that Name before you add it to the Collection.


这篇关于在图表中显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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