在form中的构造中已经在VIEW中显示初恋,现在要做的是在ComboBox显示数据库第一行的所有内容,并在选择相当内容后在VIEW能显示相关内容,
public Form1()
{
InitializeComponent();
Querys q = new Querys();
string sqlx = "time";
//如果发生改变,从ComboBOX获取改变值,改变
string sqly = "svcount";
DataTable dt = new DataTable();
int[] x = new int[70];
DateTime[] y=new DateTime[70];
int n = 0;
dt=q.Query(sqlx,500);
for (int i = 0; i <70; i++)
{
y[i] = (DateTime)dt.Rows[i][n];
}
//Y轴改变,判断datatable中的字段名
dt = q.Query(sqly, 500);
for (int i = 0; i < 70; i++)
{
x[i] = (int)dt.Rows[i][0];
}
//(纵坐标,横坐标)
LinePlot line3 = new LinePlot(x, y);
plotSurface.Add(line3);
}
/*
*
* 将是数据库中第一行所有内容在ComboBox中下拉显示
*/
private void Form1_Load(object sender, EventArgs e)
{
string sql = "*";
Querys q = new Querys();
DataTable dt = q.Query(sql, 500);
selectup.DataSource = dt;
}
private void select_SelectedIndexChanged(object sender, EventArgs e)
{
}