private void button2_Click(object sender, EventArgs e)
{
try
String query = "SELECT kode_order,tanggal_order,lead_time,jumlah,a.kode_barang,c.harga as harga_barang,import_administrasi,import_ekspedisi,import_ijin_import,lokal_administrasi,lokal_transportasi,(import_administrasi+import_ekspedisi+import_ijin_import+lokal_administrasi+lokal_transportasi) as total_ongkos_kirim FROM tb_pemesanan a join tb_ongkos b join tb_bahan_baku c WHERE a.kode_ongkos = b.kode_ongkos AND a.kode_barang=c.kode_barang ";
/*SHOW DATA BASED ON "MONTH"*/
if (cbBulan.Text != "[semua]")
query += " AND MONTH(tanggal_order) = " + cbBulan.Text;
}
/*SHOW DATA BASED ON "YEAR"*/
if (cbTahun.Text != "[semua]")
query += " AND YEAR(tanggal_order) = " + cbTahun.Text;
/*SHOW DATA BASED ON "Raw Material" (Still Error)*/
if (cbBahan_Baku.Text != "[semua]")
query += " kode_barang = " + cbBahan_Baku.Text;
query += " ORDER BY kode_order asc, tanggal_order ASC ";
DataTable dt = new DataTable();
MySqlDataAdapter dt_adapter = new MySqlDataAdapter(query, conn);
MySqlCommandBuilder cb = new MySqlCommandBuilder(dt_adapter);
dt_adapter.Fill(dt);
dataGridView1.DataSource = dt;
dataGridView1.Refresh();
catch (Exception ex)
MessageBox.Show("Can't load database\n" + ex.ToString());