If Me.tbid.Text = "" Then
MsgBox("Maaf Penggantian data Tidak Dapat dialakukan", MsgBoxStyle.Critical, " Pesan Edit ")
bersih()
Exit Sub
Else
Dim msg As DialogResult
Dim sql As String = " update buku set " & _
"Id_buku ='" & Me.tbid.Text & "'," & _
"kategory='" & Me.cbKategori.Text & "'," & _
"Judul_buku='" & Me.tbjudul.Text & "'," & _
"Pengarang='" & Me.tbpengarang.Text & "'," & _
"penerbit='" & Me.tbpenerbit.Text & "'," & _
"Tahun='" & Me.tbtahun.Text & "'," & _
"Halaman='" & Me.tbhalaman.Text & "'," & _
"harga='" & Me.tbharga.Text & "'," & _
"keterangan='" & Me.tbket.Text & "' where Id_buku ='" & Me.tbid.Text & "'"
msg = MessageBox.Show("yakin mengedit data", "konfirmasi edit", _
MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button2)
Using conn As New OleDbConnection(coneksi)
conn.Open()
Using cmd = New OleDbCommand(sql, conn)
If (msg = DialogResult.Yes) Then
Using results = cmd.ExecuteReader
End Using
MsgBox("data sudah berhasil di ubah", MsgBoxStyle.Information, " Pesan")
bersih()
Else
bersih()
End If
End Using
End Using
tampil()
End If
End Sub
Catatan : Ini koding dengan menggunakan Modul
Tidak ada komentar:
Posting Komentar