以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 图表控件出现Invalid data type (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=74124) |
-- 作者:阿福 -- 发布时间:2015/9/2 21:29:00 -- 图表控件出现Invalid data type Dim cmd As new SQLCommand Dim dt As DataTable cmd.C cmd.CommandText =" select sys_user, 胎次 as 胎次, avg(分娩_总产仔数) as 产仔数, avg(断奶_头数) as 断奶数, avg(分娩_均重) As 初生重kg, " & _ " avg(断奶_均重) as 断奶重kg f rom{母猪分娩断奶信息} where sys_user = \'" & user.Name & "\' group by sys_user, 胎次 " dt = cmd.ExecuteReader Tables("产仔数分析_table2").DataSource = dt Tables("产仔数分析_table2").DefaultColWidth = 130 For Each c As DataCol In DataTables("产仔数分析_table2").DataCols If c.Name <> "胎次" Then DataTables("产仔数分析_table2").DataCols(c.Name).SetFormat("0.0") End If Next Dim Chart As WinForm.Chart Dim Series As WinForm.ChartSeries Chart = e.Form.Controls("胎次1") Chart.ChartType = ChartTypeEnum.Bar Chart.DataSource = "产仔数分析_table2" Chart.SeriesList.Clear() Series = Chart.SeriesList.Add() Series.Text = "产仔数" MessageBox.Show(8) Series.X.DataField = "胎次" Series.Y.DataField = "产仔数" Series.DataLabelText = "{#YVAL}" Series = Chart.SeriesList.Add() Series.Text = "断奶数" Series.X.DataField = "胎次" Series.Y.DataField = "断奶数" Series.DataLabelText = "{#YVAL}" Chart.VisualEffect = True Chart.LegendVisible = True Chart.LegendCompass= CompassEnum.South Chart.AxisX.Text = "胎次" Chart.AxisY.Text = "头数" 老师,求救,代码执行到黄色部后就出现以下提示,不知哪里出错了! .NET Framework 版本:2.0.50727.8000 Foxtable 版本:2014.11.11.1 错误所在事件:窗口,产仔数分析,Button2,Click 详细错误信息: Invalid data type |
-- 作者:大红袍 -- 发布时间:2015/9/2 21:43:00 -- 你的这两个列,是数值列吗?不能是字符列
Series.Y.DataField = "产仔数"
Series.Y.DataField = "断奶数"
|
-- 作者:阿福 -- 发布时间:2015/9/2 21:50:00 -- 都是数值列 |
-- 作者:阿福 -- 发布时间:2015/9/2 22:17:00 -- 还是不行 |
-- 作者:阿福 -- 发布时间:2015/9/2 22:42:00 -- 搞定了,原来“胎次”设定为 短整数,改成整数就行了 |