//prosedr awal private void awal() { //panggil prosedur bersih Bersih(); //mennaktifkan data grid penjualan DataGridPenjualan.Enabled = false; SqlConnection conn = konn.GetConn(); { try { conn.Open(); cmd = new SqlCommand("select * from kwitansi order by NomorKwitansi desc", conn); ds = new DataSet(); da = new SqlDataAdapter(cmd); da.Fill(ds, "kwitansi"); DataGridPenjualan.DataSource = ds; DataGridPenjualan.DataMember = "kwitansi"; DataGridPenjualan.Refresh(); } catch (Exception e) { MessageBox.Show(e.ToString()); } finally { conn.Close(); } } }
//prosedur refresh penjualan private void refresh_penjualan() { //get connection SqlConnection conn = konn.GetConn(); { try { conn.Open(); cmd = new SqlCommand("select * from view_detailkwitansi where NomorKwitansi = '" + TxtNoKwitansi.Text + "'", conn); ds = new DataSet(); da = new SqlDataAdapter(cmd); da.Fill(ds, "view_detailkwitansi"); DataGridPenjualan.DataSource = ds; DataGridPenjualan.DataMember = "view_detailkwitansi"; DataGridPenjualan.Refresh(); } catch (Exception e) { MessageBox.Show(e.ToString()); } finally { conn.Close(); } } }