Berikut ini adalah bagian pengolahan data Supplier full source code yang hanya menyajikan gambar desain form pengolahan data supplier dan full coding.
untuk keterangan desain form silahkan klik Di sini. Dan untuk keterangan coding silahkan klik Di sini.
Pengolahan Data Supplier Full Source Code
Berikut ini adalah gambar dari desai Form Supplier.
Dan berikut ini adalah full coding dari Form Supplier untuk pengolahan data supplier.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
Imports System.Data.Odbc Public Class Form_suplier Sub bersihkan() TID_suplier.Focus() TID_suplier.Clear() TNamasuplier.Clear() TAlamat.Clear() TTelpon.Clear() TEmail.Clear() End Sub Sub tampilkan_data() Koneksi() DA = New OdbcDataAdapter("SELECT * FROM suplier", Conn) DS = New DataSet DA.Fill(DS, 0) DGV.DataSource = DS.Tables(0) Conn.Close() End Sub Sub Autocomplete() Koneksi() CMD = New OdbcCommand("SELECT ID_suplier FROM suplier", Conn) RD = CMD.ExecuteReader While RD.Read With TID_suplier .AutoCompleteCustomSource.Add(RD(0).ToString) .AutoCompleteMode = AutoCompleteMode.Suggest .AutoCompleteSource = AutoCompleteSource.CustomSource End With End While Conn.Close() End Sub Sub call_all() bersihkan() tampilkan_data() Autocomplete() End Sub Private Sub Form_suplier_Load(sender As Object, e As EventArgs) Handles MyBase.Load call_all() End Sub Private Sub TTelpon_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TTelpon.KeyPress If Not IsNumeric(e.KeyChar) And e.KeyChar <> Chr(13) And e.KeyChar <> vbBack Then e.Handled = True End Sub Private Sub TID_suplier_KeyDown(sender As Object, e As KeyEventArgs) Handles TID_suplier.KeyDown If e.KeyCode = Keys.Enter Then Koneksi() CMD = New OdbcCommand("SELECT * FROM suplier WHERE ID_suplier = '" + TID_suplier.Text + "'", Conn) RD = CMD.ExecuteReader If RD.Read Then TID_suplier.Text = RD(0).ToString TNamasuplier.Text = RD(1).ToString TAlamat.Text = RD(2).ToString TTelpon.Text = RD(3).ToString TEmail.Text = RD(4).ToString End If Conn.Close() TNamasuplier.Focus() End If End Sub Private Sub TID_suplier_TextChanged(sender As Object, e As EventArgs) Handles TID_suplier.TextChanged Try Koneksi() DA = New OdbcDataAdapter("SELECT * FROM suplier WHERE ID_suplier LIKE '%" + TID_suplier.Text + "%'", Conn) DS = New DataSet DA.Fill(DS, 0) DGV.DataSource = DS.Tables(0) Conn.Close() Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub DGV_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DGV.CellClick Try Dim i = e.RowIndex Koneksi() CMD = New OdbcCommand("SELECT * FROM suplier WHERE ID_suplier = '" + DGV.Item(0, i).Value + "'", Conn) RD = CMD.ExecuteReader If RD.HasRows Then TID_suplier.Text = RD(0).ToString TNamasuplier.Text = RD(1).ToString TAlamat.Text = RD(2).ToString TTelpon.Text = RD(3).ToString TEmail.Text = RD(4).ToString End If Conn.Close() Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub BSimpan_Click(sender As Object, e As EventArgs) Handles BSimpan.Click Try If TID_suplier.Text = "" Then MsgBox("Isi terlebih dahulu ID suplier") Else Koneksi() CMD = New OdbcCommand("SELECT ID_suplier FROM suplier WHERE ID_suplier = '" + TID_suplier.Text + "'", Conn) RD = CMD.ExecuteReader RD.Read() If Not RD.HasRows Then Koneksi() CMD = New OdbcCommand("INSERT INTO suplier VALUES (?,?,?,?,?)", Conn) With CMD .Parameters.AddWithValue("?", TID_suplier.Text) .Parameters.AddWithValue("?", TNamasuplier.Text) .Parameters.AddWithValue("?", TAlamat.Text) .Parameters.AddWithValue("?", TTelpon.Text) .Parameters.AddWithValue("?", TEmail.Text) .ExecuteNonQuery() End With Conn.Close() Else Koneksi() CMD = New OdbcCommand("UPDATE suplier SET nama_suplier=?, alamat=?, telp=?, email=? WHERE ID_suplier=?", Conn) With CMD .Parameters.AddWithValue("?", TNamasuplier.Text) .Parameters.AddWithValue("?", TAlamat.Text) .Parameters.AddWithValue("?", TTelpon.Text) .Parameters.AddWithValue("?", TEmail.Text) .Parameters.AddWithValue("?", TID_suplier.Text) .ExecuteNonQuery() End With Conn.Close() End If Conn.Close() call_all() End If Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub BHapus_Click(sender As Object, e As EventArgs) Handles BHapus.Click If TID_suplier.Text = "" Then MsgBox("Isi terlebih dahulu ID suplier") ElseIf MsgBox("Apakah Anda yakin ingin menghapus data ini?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then Try Koneksi() CMD = New OdbcCommand("DELETE FROM suplier WHERE ID_suplier ='" + TID_suplier.Text + "'", Conn) CMD.ExecuteNonQuery() Conn.Close() tampilkan_data() call_all() Catch ex As Exception MsgBox(ex.Message) End Try Else bersihkan() End If End Sub Private Sub BBatal_Click(sender As Object, e As EventArgs) Handles BBatal.Click call_all() End Sub End Class |
Thanks for finally talking about >Pengolahan Data Supplier Full Source Code – Kolektor Ilmu <Loved it!