1.绑定到OleDbDataReader:

// Define the database query
string mySelectQuery="SELECT Name, Sales FROM REPS;";
// 。。。。。。
// Create a database reader
OleDbDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection); // Since the reader implements and IEnumerable, pass the reader directly into
// the DataBindTable method with the name of the Column to be used as the XValue
Chart1.DataBindTable(myReader, "Name");

2.绑定DataSource

// Define the database query
string mySelectQuery="SELECT * FROM REPS;"; // Create a database connection object using the connection string
OleDbConnection myConnection = new OleDbConnection(myConnectionString);
// Create a database command on the connection using query
OleDbCommand myCommand = new OleDbCommand(mySelectQuery, myConnection);
myConnection.Open();
// set chart data source - the data source must implement IEnumerable
chart1.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

// Set series members names for the X and Y values
chart1.Series["Series 1"].XValueMember = "Name";
chart1.Series["Series 1"].YValueMembers = "Sales"
; // Data bind to the selected data source
chart1.DataBind();

3.绑定Y值

// Create a database reader
OleDbDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection); // Since the reader implements and IEnumerable, pass the reader directly into
// the DataBind method with the name of the Column selected in the query
chart1.Series["Default"].Points.DataBindY(myReader, "GrossSales");

4.绑定X和Y

// Create a database reader
OleDbDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection); // Since the reader implements IEnumerable, pass the reader directly into
// the DataBind method with the name of the Column selected in the query
chart1.Series["Default"].Points.DataBindXY(myReader, "Name", myReader, "Sales");

最新文章

  1. 建模元件有哪些在MapleSim中
  2. entity framework 5 批量增删改效率优化
  3. 简单使用AutoMapper实现DTO转换
  4. 【JavaScript】JS_Object跟Function的区别
  5. Python 实现粒子滤波
  6. quartus II PIN脚相关之一
  7. 高性能的数据压缩库libzling
  8. Google Appengine参考路径
  9. JPA---一对一关系
  10. 画画 保存为图片 MaskFilter 边缘效果
  11. 菜鸟进阶Android Touch事件传递(四)
  12. 山谈c中printf格式修饰符
  13. R语言重要数据集分析研究——需要整理分析阐明理念
  14. iOS libyuv
  15. OpenCV+TensorFlow实现自定义手写图像识别
  16. idea 中dao层自动生成接口
  17. 关键词提取_tf_idf
  18. 【面试】iOS 开发面试题(二)
  19. mysql出现1030 Got error 28 from storage engine解决方法
  20. Volley 解析

热门文章

  1. Coursera台大机器学习技法课程笔记03-Kernel Support Vector Machine
  2. bash read命令用法
  3. swift init继承问题
  4. 转centos65安装简测mysql cluster 7.3.7
  5. codeforces B. Routine Problem 解题报告
  6. CSS 样式显示为小手
  7. ios学习总结(1) -- 创建第一个ios项目
  8. python基础——切片
  9. delete 类对象指针的注意事项]
  10. p235习题2