问下WINFORM画饼图,柱图问题
代码取自这里,http://blog.csdn.net/hlbd_edu/archive/2006/11/07/1371554.aspx我先在数据库建了个表,就一个INT的列,然后写上数字,
之后在窗体构造函数中加上这几句
BaseLayer.BarChart pic= new BaseLayer.BarChart(); //这个不知是生成什么图的对象
SqlConnection con = new SqlConnection("server=.;database=pubs;uid=sa"); //连接对象
SqlDataAdapter da = new SqlDataAdapter("select count from A", con);
DataSet ds = new DataSet();
da.Fill(ds, "A");
pic.Render("aaa", "bbb", 100, 200, ds); //调用它的方法
然后每次走到 barHeight = Convert.ToSingle(dt.Rows) * 200 / highPoint * 1; 这一行,就报错说
无法将类型为“System.Data.DataRow”的对象强制转换为类型“System.IConvertible”。
这怎么回事,是不是我用错了?应该怎么用呢这代码? 对C#了解不多,就知道在IDE里,有个画饼图的控件... 有自带的控件? BarChart是柱状图,我喜欢叫棒图
提示:一个DataRow对象里有多个column……dt.Rows["count"]
页:
[1]