Пример #1
0
 private void Command2_Click(System.Object _sender, System.EventArgs _e1)
 {
     Adodc1.Recordset.Find("No_TP='" + Text1.Text + "'", nce.adodb.SearchDirection.adSearchForward, 1);
     if (!(Adodc1.Recordset.Eof))
     {
         MessageBox.Show("Kode TP sudah ada sebelumnya atau nomor urut telah ada sebelumnya", "Project1");
     }
     else
     {
         if (Text1.Text == "" || Text2.Text == "" || Text3.Text == "")
         {
             MessageBox.Show("Data Kurang Lengkap", "Project1", MessageBoxButtons.OK, MessageBoxIcon.Error);
             Text1.Focus();
         }
         else
         {
             Adodc1.Recordset.Fields["No_TP"].Value   = Text1.Text;
             Adodc1.Recordset.Fields["Nama_TP"].Value = Text2.Text;
             Adodc1.Recordset.Fields["alamat"].Value  = Text3.Text;
             Adodc1.Recordset.Update();
             Adodc1.Refresh();
             TDBGrid1.Refresh();
             Text1.Text       = "";
             Text2.Text       = "";
             Text3.Text       = "";
             Command2.Enabled = false;
             Command1.Enabled = true;
         }
     }
 }
Пример #2
0
 private void Command3_Click(System.Object _sender, System.EventArgs _e1)
 {
     if (Adodc1.Recordset.RecordCount == 0)
     {
         MessageBox.Show("Data Tidak Ada", "Project1", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Adodc1.Recordset.Delete();
         Adodc1.Recordset.Update();
         Adodc1.Refresh();
         TDBGrid1.Refresh();
         Text1.Focus();
     }
 }
 private void Command1_Click(System.Object _sender, System.EventArgs _e1)
 {
     if (Text1.Text == "" || Text2.Text == "" || Text3.Text == "" || Text4.Text == "" || Text5.Text == "" || Text1.Text == "0" || Text2.Text == "0" || Text3.Text == "0" || Text4.Text == "0" || Text5.Text == "0")
     {
         MessageBox.Show("Data Belum Lengkap", "Project1", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Adodc1.Recordset.Fields["pengali"].Value        = Text1.Text;
         Adodc1.Recordset.Fields["plafonlintang1"].Value = Text2.Text;
         Adodc1.Recordset.Fields["plafonlintang2"].Value = Text3.Text;
         Adodc1.Recordset.Fields["plafonlintang3"].Value = Text4.Text;
         Adodc1.Recordset.Fields["plafonlintang4"].Value = Text5.Text;
         Adodc1.Recordset.Update();
         Adodc1.Refresh();
         TDBGrid1.Refresh();
     }
     tampil();
 }