예제 #1
0
        public void loadComboPeriode()
        {
            string sql = "SELECT DATE_FORMAT(Tanggal,'%Y-%M') as Periode FROM notajual GROUP BY DATE_FORMAT(Tanggal,'%Y-%M')";

            comboBoxBulan.Items.Clear();
            try
            {
                //Koneksi.JalankanPerintahDML(sql);
                MySqlDataReader rd = Koneksi.JalankanPerintahQuery(sql);
                comboBoxBulan.Items.Add("Semua Tampil");
                while (rd.Read())
                {
                    comboBoxBulan.Items.Add(rd["Periode"] + "");
                }
                rd.Close();
                comboBoxBulan.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }