using System;
using System.Data;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using System.Data.SqlClient;
namespace Chart
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
chart1.Series.Clear();
using (SqlConnection conn = new SqlConnection(“server=(local);database=mydb;user id=sa;password=sa;min pool size=20;max pool size=100;Connection Lifetime=30;Enlist=true;”))
{
using (SqlDataAdapter adapter = new SqlDataAdapter(“select top 8 id,total from table1”, conn))
{
DataTable table = new DataTable();
adapter.Fill(table);
Series series = new Series();
series.Points.DataBindXY(table.DefaultView, “id”, table.DefaultView, “total”);
chart1.Series.Add(series);
}
}
}
}
}
如题, Series series = new Series();这句一直报错错误未能找到类型或命名空间名称“Series”(能否缺少 using 指令或程序集引用?) ,搜不到应该添加哪个using,求帮助
using System.Data;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using System.Data.SqlClient;
namespace Chart
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
chart1.Series.Clear();
using (SqlConnection conn = new SqlConnection(“server=(local);database=mydb;user id=sa;password=sa;min pool size=20;max pool size=100;Connection Lifetime=30;Enlist=true;”))
{
using (SqlDataAdapter adapter = new SqlDataAdapter(“select top 8 id,total from table1”, conn))
{
DataTable table = new DataTable();
adapter.Fill(table);
Series series = new Series();
series.Points.DataBindXY(table.DefaultView, “id”, table.DefaultView, “total”);
chart1.Series.Add(series);
}
}
}
}
}
如题, Series series = new Series();这句一直报错错误未能找到类型或命名空间名称“Series”(能否缺少 using 指令或程序集引用?) ,搜不到应该添加哪个using,求帮助
解决方案
20