[英]Drawig Graphics in Windows Forms Application C#
大家好,我需要一些幫助來在 Windows 窗體應用程序中繪制圖形。
我從這里下載了 Nevron Chart for .NET Community Edition:
https://www.nevron.com/products-dot-net-chart-free-control
我從 Windows 窗體應用程序中的工具中拖出一張圖表
所以我在圖表中與 MySql 建立連接,但我需要在圖表中導出查詢。
我的代碼是:
private void chart1_Click(object sender, EventArgs e) {
string MyConString3 = "SERVER=localhost;" + "DATABASE=hydrodb;" +
"UID=root;" + "PASSWORD=;";
MySqlConnection connection3 = new MySqlConnection(MyConString3);
string command3 = "select year(Dat),month(Dat),min(vkolmin),avg(Vkolsre),Max(Vkolmax) from hydmes where station='"
+ comboBox1.SelectedItem.ToString() + "' and Dat between '"
+ comboBox2.SelectedItem.ToString() + "' and '" + comboBox3.SelectedItem.ToString()
+ "' group by year(dat),month(Dat)";
MySqlDataAdapter da3 = new MySqlDataAdapter(command3, connection3);
DataTable dt3 = new DataTable();
da3.Fill(dt3);
string s = "";
foreach (DataRow row in dt3.Rows) {
string rowz = string.Format("{0}, {1}, {2}, {3}, {4}", row.ItemArray[0], row.ItemArray[1], row.ItemArray[2],
row.ItemArray[3], row.ItemArray[4]);
s += "-" + rowz;
}
connection3.Close();
}
我不確定是否需要 foreach ?
我需要從
string command3 = "select year(Dat),month(Dat),min(vkolmin),avg(Vkolsre),Max(Vkolmax) from hydmes where station='"
+ comboBox1.SelectedItem.ToString() + "' and Dat between '"
+ comboBox2.SelectedItem.ToString() + "' and '" + comboBox3.SelectedItem.ToString()
+ "' group by year(dat),month(Dat)";`
在圖表中 ?
一些幫助代碼?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.