-6
我有一个组合框填充mysql数据库。 我想在用户从组合框中选择一年时间后,在想要单击按钮并移至下一年后,创建两个靠近组合框的按钮。如何从数据库c创建下一个和上一个按钮年#
现在我有了这个代码来从数据库中获得数年。
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string command1 = "select year(Dat) FROM hydgod where Station=" + comboBox1.Text;
MySqlDataAdapter da1 = new MySqlDataAdapter(command1, connection);
DataTable dt1 = new DataTable();
da1.Fill(dt1);
comboBox2.Items.Clear();
comboBox2.SelectedItem = -1;
foreach (DataRow row in dt1.Rows)
{
string rowz = string.Format("{0}", row.ItemArray[0]);
comboBox2.Items.Add(rowz);
comboBox2.AutoCompleteCustomSource.Add(row.ItemArray[0].ToString());
}
}
我该如何从组合框中选定年份,并在+1下增加下一年的增量,并且在上一年减少-1?