-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?