SlideShare a Scribd company logo
LATIHAN CRUD VB2010 DENGAN MS. ACCESS 2007 (BY: DIK-DIK.COM)
1. Buat database denganMs. Accces 2007, sbb:
Simpandi projectini,caranyaklikkananpada nama project:
Masuk ke FolderBin  Debug,masukandatabase ke folderini.
2. Buat Module Koneksi
KlikmenuProject  AddModule,ketikankodingberikutini:
Imports System.Data.OleDb
Module Module1
Public Conn As OleDbConnection
Public da As OleDbDataAdapter
Public ds As DataSet
Public cmd As OleDbCommand
Public rd As OleDbDataReader
Public Sub Koneksi()
Conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=PTABC.ACCDB")
Conn.Open()
End Sub
End Module
3. Buat tampilan Design sbb:
Object Properti Value
Form Name Pegawai
Textbox1 Name txtKOPEG
Textbox2 Name txtNAPEG
Textbox3 Name txtUsia
Button1 Name btnNew
Text NEW
Button2 Name btnSave
Text SAVE
Button3 Name btnEdit
Text EDIT
Button4 Name btnDelete
Text DELETE
Button5 Name btnExit
Text EXIT
DataGridView Name DGV
Radiobutton1 Name OPTJK
RadioButton2 Name OPTJK2
Berikutkodingnyasbb:
Imports System.Data.OleDb
Public Class Pegawai
Dim JK As String
Sub tampilkan()
da = New OleDbDataAdapter("select * from PEGAWAI", Conn)
ds = New DataSet
ds.Clear()
da.Fill(ds, "PEGAWAI")
DGV.DataSource = (ds.Tables("PEGAWAI"))
DGV.ReadOnly = True
End Sub
Sub kosongkan()
txtKOPEG.Enabled = True
txtNAPEG.Enabled = True
txtUsia.Enabled = True
txtNAPEG.Text = ""
txtUsia.Text = ""
txtKOPEG.Focus()
End Sub
Private Sub Pegawai_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Call Koneksi()
Call tampilkan()
txtKOPEG.Enabled = False
txtNAPEG.Enabled = False
txtUsia.Enabled = False
btnDelete.Enabled = False
btnEdit.Enabled = False
btnSave.Enabled = False
End Sub
Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnNew.Click
Call kosongkan()
End Sub
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnDelete.Click
If txtKOPEG.Text = "" Then
MsgBox("Isi kode Pegawai terlebih dahulu")
txtKOPEG.Focus()
Exit Sub
Else
If MessageBox.Show("Yakin akan dihapus..?", "", MessageBoxButtons.YesNo) =
Windows.Forms.DialogResult.Yes Then
cmd = New OleDbCommand("delete * from PEGAWAI where KOPEG = '" &
txtKOPEG.Text & "'", Conn)
cmd.ExecuteNonQuery()
Call kosongkan()
Call tampilkan()
Else
Call kosongkan()
End If
End If
End Sub
Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnEdit.Click
If txtKOPEG.Text = "" Then
MsgBox("Isi kode Pegawai terlebih dahulu")
txtNAPEG.Focus()
Exit Sub
Else
If MessageBox.Show("Yakin akan di Edit..?", "", MessageBoxButtons.YesNo) =
Windows.Forms.DialogResult.Yes Then
cmd = New OleDbCommand("update PEGAWAI set NAPEG ='" & txtNAPEG.Text & "',
USIA =" & txtUsia.Text & ",JK='" & JK & "' where KOPEG = '" & txtKOPEG.Text & "'", Conn)
cmd.ExecuteNonQuery()
txtKOPEG.Text = ""
Call kosongkan()
Call tampilkan()
Else
Call kosongkan()
End If
End If
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnExit.Click
If MessageBox.Show("Yakin akan keluar..?", "", MessageBoxButtons.YesNo) =
Windows.Forms.DialogResult.Yes Then
End
End If
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnSave.Click
Dim sqltambah As String = "insert into PEGAWAI(KOPEG,NAPEG,USIA, JK) values " & _
"('" & txtKOPEG.Text & "','" & txtNAPEG.Text & "'," & txtUsia.Text & ",'" &
JK & "')"
cmd = New OleDbCommand(sqltambah, Conn)
cmd.ExecuteNonQuery()
txtKOPEG.Text = ""
Call tampilkan()
Call kosongkan()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Form2.Show()
End Sub
Private Sub OptJK_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles OptJK.CheckedChanged
If OptJK.Enabled = True Then
JK = "L"
End If
End Sub
Private Sub optJK2_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles optJK2.CheckedChanged
If optJK2.Enabled = True Then
JK = "P"
End If
End Sub
Private Sub txtKOPEG_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtKOPEG.KeyPress
Dim x As String
If e.KeyChar = Chr(13) Then
cmd = New OleDbCommand("select * from Pegawai where KOPEG='" & txtKOPEG.Text &
"'", Conn)
rd = cmd.ExecuteReader
rd.Read()
If rd.HasRows = True Then
txtNAPEG.Text = rd.GetString(1)
txtUsia.Text = rd.GetValue(2)
x = rd.GetString(3)
If x = "L" Then
OptJK.Checked = True
ElseIf x = "P" Then
optJK2.Checked = True
End If
txtNAPEG.Focus()
btnSave.Enabled = False
btnEdit.Enabled = True
btnDelete.Enabled = True
Else
Call kosongkan()
txtNAPEG.Focus()
btnSave.Enabled = True
End If
End If
End Sub
End Class

More Related Content

What's hot

DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
GOKUL SREE
 
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERINSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
Darwin Durand
 
Codes
CodesCodes
Codes
OSit3
 
Vb database connections
Vb database connectionsVb database connections
Vb database connections
Tharsikan
 
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Backup And Restore NGL Database
Backup And Restore NGL DatabaseBackup And Restore NGL Database
Backup And Restore NGL Database
Ashok Kumar Satapathy
 
Windows 8 Training Fundamental - 1
Windows 8 Training Fundamental - 1Windows 8 Training Fundamental - 1
Windows 8 Training Fundamental - 1Kevin Octavian
 
Lenguaje de programación
Lenguaje de programaciónLenguaje de programación
Lenguaje de programación
lhaylha moran
 
Url&doc html
Url&doc htmlUrl&doc html
Url&doc html
akila m
 
Laporan tugas mata kuliah pbo yg ke 3
Laporan tugas mata kuliah pbo yg ke 3Laporan tugas mata kuliah pbo yg ke 3
Laporan tugas mata kuliah pbo yg ke 3Helmita putri
 
Linked In Presentation
Linked In PresentationLinked In Presentation
Linked In Presentation
apweir12
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
GOKUL SREE
 
Ext GWT 3.0 Layouts
Ext GWT 3.0 LayoutsExt GWT 3.0 Layouts
Ext GWT 3.0 Layouts
Sencha
 
State management in asp
State management in aspState management in asp
State management in asp
Ibrahim MH
 
Getting classy with ES6
Getting classy with ES6Getting classy with ES6
Getting classy with ES6
Andy Sharman
 
 Exchange migration of legacy public folders to 2013
 Exchange   migration of legacy public folders to 2013 Exchange   migration of legacy public folders to 2013
 Exchange migration of legacy public folders to 2013Gary Jackson
 
Make an html validator extension
Make an html validator extensionMake an html validator extension
Make an html validator extension
Rebecca Peltz
 

What's hot (20)

DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
 
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERINSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
 
Codes
CodesCodes
Codes
 
Vb database connections
Vb database connectionsVb database connections
Vb database connections
 
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
 
Backup And Restore NGL Database
Backup And Restore NGL DatabaseBackup And Restore NGL Database
Backup And Restore NGL Database
 
Windows 8 Training Fundamental - 1
Windows 8 Training Fundamental - 1Windows 8 Training Fundamental - 1
Windows 8 Training Fundamental - 1
 
Lenguaje de programación
Lenguaje de programaciónLenguaje de programación
Lenguaje de programación
 
PHP with MYSQL
PHP with MYSQLPHP with MYSQL
PHP with MYSQL
 
Url&doc html
Url&doc htmlUrl&doc html
Url&doc html
 
Laporan tugas mata kuliah pbo yg ke 3
Laporan tugas mata kuliah pbo yg ke 3Laporan tugas mata kuliah pbo yg ke 3
Laporan tugas mata kuliah pbo yg ke 3
 
Linked In Presentation
Linked In PresentationLinked In Presentation
Linked In Presentation
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
 
Ext GWT 3.0 Layouts
Ext GWT 3.0 LayoutsExt GWT 3.0 Layouts
Ext GWT 3.0 Layouts
 
Quanlycanbo
QuanlycanboQuanlycanbo
Quanlycanbo
 
State management in asp
State management in aspState management in asp
State management in asp
 
Active Record
Active RecordActive Record
Active Record
 
Getting classy with ES6
Getting classy with ES6Getting classy with ES6
Getting classy with ES6
 
 Exchange migration of legacy public folders to 2013
 Exchange   migration of legacy public folders to 2013 Exchange   migration of legacy public folders to 2013
 Exchange migration of legacy public folders to 2013
 
Make an html validator extension
Make an html validator extensionMake an html validator extension
Make an html validator extension
 

Viewers also liked

5.05 eng
5.05 eng5.05 eng
5.05 eng
Robert Phillips
 
3Com JD008A
3Com JD008A3Com JD008A
3Com JD008A
savomir
 
Браслеты Пандора
Браслеты ПандораБраслеты Пандора
Браслеты Пандора
Екатерина Чедея
 
3Com JE015A
3Com JE015A3Com JE015A
3Com JE015A
savomir
 
Actividad no. 8 carlos h. muñoz.
Actividad no. 8 carlos h. muñoz.Actividad no. 8 carlos h. muñoz.
Actividad no. 8 carlos h. muñoz.
charleshamil
 
Sistemas Operativos
Sistemas Operativos Sistemas Operativos
Sistemas Operativos
Ariadna GochiGutierrez
 
3Com 3C17512
3Com 3C175123Com 3C17512
3Com 3C17512
savomir
 
Fsmith 2017 02_09_09_29_27 (1)
Fsmith 2017 02_09_09_29_27 (1)Fsmith 2017 02_09_09_29_27 (1)
Fsmith 2017 02_09_09_29_27 (1)
megansaunders99
 
Talleres didácticos de arqueología
Talleres didácticos de arqueologíaTalleres didácticos de arqueología
Talleres didácticos de arqueología
José Carlos Sastre Blanco
 
Ken collis
Ken collisKen collis
Ken collis
Ken Collis
 
A domain specific language for configurable traceability analysis
A domain specific language for configurable traceability analysisA domain specific language for configurable traceability analysis
A domain specific language for configurable traceability analysis
Hendrik Bünder
 
Slow Down Online Guessing Attacks with Device Cookies
Slow Down Online Guessing Attacks with Device CookiesSlow Down Online Guessing Attacks with Device Cookies
Slow Down Online Guessing Attacks with Device Cookies
Anton Dedov
 
Circuitos eléctricos en serie
Circuitos eléctricos en serieCircuitos eléctricos en serie
Circuitos eléctricos en serie
maría torrez
 
Proyecto jelitza moreira
Proyecto jelitza moreiraProyecto jelitza moreira
Proyecto jelitza moreira
Ginzo17
 

Viewers also liked (15)

Slade share
Slade shareSlade share
Slade share
 
5.05 eng
5.05 eng5.05 eng
5.05 eng
 
3Com JD008A
3Com JD008A3Com JD008A
3Com JD008A
 
Браслеты Пандора
Браслеты ПандораБраслеты Пандора
Браслеты Пандора
 
3Com JE015A
3Com JE015A3Com JE015A
3Com JE015A
 
Actividad no. 8 carlos h. muñoz.
Actividad no. 8 carlos h. muñoz.Actividad no. 8 carlos h. muñoz.
Actividad no. 8 carlos h. muñoz.
 
Sistemas Operativos
Sistemas Operativos Sistemas Operativos
Sistemas Operativos
 
3Com 3C17512
3Com 3C175123Com 3C17512
3Com 3C17512
 
Fsmith 2017 02_09_09_29_27 (1)
Fsmith 2017 02_09_09_29_27 (1)Fsmith 2017 02_09_09_29_27 (1)
Fsmith 2017 02_09_09_29_27 (1)
 
Talleres didácticos de arqueología
Talleres didácticos de arqueologíaTalleres didácticos de arqueología
Talleres didácticos de arqueología
 
Ken collis
Ken collisKen collis
Ken collis
 
A domain specific language for configurable traceability analysis
A domain specific language for configurable traceability analysisA domain specific language for configurable traceability analysis
A domain specific language for configurable traceability analysis
 
Slow Down Online Guessing Attacks with Device Cookies
Slow Down Online Guessing Attacks with Device CookiesSlow Down Online Guessing Attacks with Device Cookies
Slow Down Online Guessing Attacks with Device Cookies
 
Circuitos eléctricos en serie
Circuitos eléctricos en serieCircuitos eléctricos en serie
Circuitos eléctricos en serie
 
Proyecto jelitza moreira
Proyecto jelitza moreiraProyecto jelitza moreira
Proyecto jelitza moreira
 

Similar to CRUD VB2010

Membuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaMembuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhana
Yusman Kurniadi
 
Ditec esoft C# project
Ditec esoft C# project Ditec esoft C# project
Ditec esoft C# project
K.K.T Madhusanka
 
Ditec esoft C# project
Ditec esoft C# projectDitec esoft C# project
Ditec esoft C# project
K.K.T Madhusanka
 
Inventory management
Inventory managementInventory management
Inventory managementRajeev Sharan
 
The Ring programming language version 1.6 book - Part 31 of 189
The Ring programming language version 1.6 book - Part 31 of 189The Ring programming language version 1.6 book - Part 31 of 189
The Ring programming language version 1.6 book - Part 31 of 189
Mahmoud Samir Fayed
 
Kode vb.net
Kode vb.netKode vb.net
Kode vb.net
Azki Nabidin
 
The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202
Mahmoud Samir Fayed
 
Ebooktiketkapal
EbooktiketkapalEbooktiketkapal
Ebooktiketkapaldhi her
 
The Ring programming language version 1.7 book - Part 32 of 196
The Ring programming language version 1.7 book - Part 32 of 196The Ring programming language version 1.7 book - Part 32 of 196
The Ring programming language version 1.7 book - Part 32 of 196
Mahmoud Samir Fayed
 
โครงการ 5 บท
โครงการ 5 บทโครงการ 5 บท
โครงการ 5 บทMareenaHahngeh
 
โครงการ 5 บท
โครงการ 5 บทโครงการ 5 บท
โครงการ 5 บทMareenaHahngeh
 
The Ring programming language version 1.3 book - Part 20 of 88
The Ring programming language version 1.3 book - Part 20 of 88The Ring programming language version 1.3 book - Part 20 of 88
The Ring programming language version 1.3 book - Part 20 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 37 of 212
The Ring programming language version 1.10 book - Part 37 of 212The Ring programming language version 1.10 book - Part 37 of 212
The Ring programming language version 1.10 book - Part 37 of 212
Mahmoud Samir Fayed
 
A Matter Of Form: Access Forms to make reporting a snap (or a click)
A Matter Of Form: Access Forms to make reporting a snap (or a click)A Matter Of Form: Access Forms to make reporting a snap (or a click)
A Matter Of Form: Access Forms to make reporting a snap (or a click)
Alan Manifold
 
Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01mafv1976
 
Imports System.Data.OleDb Public Class Form1 Dim connc As Ne.pdf
Imports System.Data.OleDb Public Class Form1     Dim connc As Ne.pdfImports System.Data.OleDb Public Class Form1     Dim connc As Ne.pdf
Imports System.Data.OleDb Public Class Form1 Dim connc As Ne.pdf
fantabulustredingco
 
The Ring programming language version 1.5.1 book - Part 27 of 180
The Ring programming language version 1.5.1 book - Part 27 of 180The Ring programming language version 1.5.1 book - Part 27 of 180
The Ring programming language version 1.5.1 book - Part 27 of 180
Mahmoud Samir Fayed
 
Qtp test
Qtp testQtp test
Qtp test
G.C Reddy
 

Similar to CRUD VB2010 (20)

Membuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaMembuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhana
 
Ditec esoft C# project
Ditec esoft C# project Ditec esoft C# project
Ditec esoft C# project
 
Ditec esoft C# project
Ditec esoft C# projectDitec esoft C# project
Ditec esoft C# project
 
Inventory management
Inventory managementInventory management
Inventory management
 
The Ring programming language version 1.6 book - Part 31 of 189
The Ring programming language version 1.6 book - Part 31 of 189The Ring programming language version 1.6 book - Part 31 of 189
The Ring programming language version 1.6 book - Part 31 of 189
 
Kode vb.net
Kode vb.netKode vb.net
Kode vb.net
 
The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202The Ring programming language version 1.8 book - Part 34 of 202
The Ring programming language version 1.8 book - Part 34 of 202
 
Ebooktiketkapal
EbooktiketkapalEbooktiketkapal
Ebooktiketkapal
 
QTP
QTPQTP
QTP
 
The Ring programming language version 1.7 book - Part 32 of 196
The Ring programming language version 1.7 book - Part 32 of 196The Ring programming language version 1.7 book - Part 32 of 196
The Ring programming language version 1.7 book - Part 32 of 196
 
โครงการ 5 บท
โครงการ 5 บทโครงการ 5 บท
โครงการ 5 บท
 
โครงการ 5 บท
โครงการ 5 บทโครงการ 5 บท
โครงการ 5 บท
 
The Ring programming language version 1.3 book - Part 20 of 88
The Ring programming language version 1.3 book - Part 20 of 88The Ring programming language version 1.3 book - Part 20 of 88
The Ring programming language version 1.3 book - Part 20 of 88
 
The Ring programming language version 1.10 book - Part 37 of 212
The Ring programming language version 1.10 book - Part 37 of 212The Ring programming language version 1.10 book - Part 37 of 212
The Ring programming language version 1.10 book - Part 37 of 212
 
A Matter Of Form: Access Forms to make reporting a snap (or a click)
A Matter Of Form: Access Forms to make reporting a snap (or a click)A Matter Of Form: Access Forms to make reporting a snap (or a click)
A Matter Of Form: Access Forms to make reporting a snap (or a click)
 
Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01
 
ALL NEW OOP 2014
ALL NEW OOP 2014ALL NEW OOP 2014
ALL NEW OOP 2014
 
Imports System.Data.OleDb Public Class Form1 Dim connc As Ne.pdf
Imports System.Data.OleDb Public Class Form1     Dim connc As Ne.pdfImports System.Data.OleDb Public Class Form1     Dim connc As Ne.pdf
Imports System.Data.OleDb Public Class Form1 Dim connc As Ne.pdf
 
The Ring programming language version 1.5.1 book - Part 27 of 180
The Ring programming language version 1.5.1 book - Part 27 of 180The Ring programming language version 1.5.1 book - Part 27 of 180
The Ring programming language version 1.5.1 book - Part 27 of 180
 
Qtp test
Qtp testQtp test
Qtp test
 

More from Achmad Sidik

Program Kasir c++(case ROti88)
Program Kasir c++(case ROti88)Program Kasir c++(case ROti88)
Program Kasir c++(case ROti88)
Achmad Sidik
 
goto dengan C++
goto dengan C++goto dengan C++
goto dengan C++
Achmad Sidik
 
Menghitung Luas Bangunan dengan C++
Menghitung Luas Bangunan dengan C++Menghitung Luas Bangunan dengan C++
Menghitung Luas Bangunan dengan C++
Achmad Sidik
 
Latihan C++ menggunakan setConsoleCursorPosition
Latihan C++ menggunakan setConsoleCursorPositionLatihan C++ menggunakan setConsoleCursorPosition
Latihan C++ menggunakan setConsoleCursorPosition
Achmad Sidik
 
Membuat Aplikasi dengan C++
Membuat Aplikasi dengan C++Membuat Aplikasi dengan C++
Membuat Aplikasi dengan C++
Achmad Sidik
 
Program menghitung angka genap dengan C++
Program menghitung angka genap dengan C++Program menghitung angka genap dengan C++
Program menghitung angka genap dengan C++
Achmad Sidik
 
CRUD dengan asp classic
CRUD dengan asp classicCRUD dengan asp classic
CRUD dengan asp classic
Achmad Sidik
 

More from Achmad Sidik (7)

Program Kasir c++(case ROti88)
Program Kasir c++(case ROti88)Program Kasir c++(case ROti88)
Program Kasir c++(case ROti88)
 
goto dengan C++
goto dengan C++goto dengan C++
goto dengan C++
 
Menghitung Luas Bangunan dengan C++
Menghitung Luas Bangunan dengan C++Menghitung Luas Bangunan dengan C++
Menghitung Luas Bangunan dengan C++
 
Latihan C++ menggunakan setConsoleCursorPosition
Latihan C++ menggunakan setConsoleCursorPositionLatihan C++ menggunakan setConsoleCursorPosition
Latihan C++ menggunakan setConsoleCursorPosition
 
Membuat Aplikasi dengan C++
Membuat Aplikasi dengan C++Membuat Aplikasi dengan C++
Membuat Aplikasi dengan C++
 
Program menghitung angka genap dengan C++
Program menghitung angka genap dengan C++Program menghitung angka genap dengan C++
Program menghitung angka genap dengan C++
 
CRUD dengan asp classic
CRUD dengan asp classicCRUD dengan asp classic
CRUD dengan asp classic
 

Recently uploaded

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 

Recently uploaded (20)

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 

CRUD VB2010

  • 1. LATIHAN CRUD VB2010 DENGAN MS. ACCESS 2007 (BY: DIK-DIK.COM) 1. Buat database denganMs. Accces 2007, sbb: Simpandi projectini,caranyaklikkananpada nama project: Masuk ke FolderBin  Debug,masukandatabase ke folderini. 2. Buat Module Koneksi KlikmenuProject  AddModule,ketikankodingberikutini: Imports System.Data.OleDb Module Module1 Public Conn As OleDbConnection Public da As OleDbDataAdapter Public ds As DataSet Public cmd As OleDbCommand Public rd As OleDbDataReader Public Sub Koneksi() Conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=PTABC.ACCDB") Conn.Open() End Sub End Module
  • 2. 3. Buat tampilan Design sbb: Object Properti Value Form Name Pegawai Textbox1 Name txtKOPEG Textbox2 Name txtNAPEG Textbox3 Name txtUsia Button1 Name btnNew Text NEW Button2 Name btnSave Text SAVE Button3 Name btnEdit Text EDIT Button4 Name btnDelete Text DELETE Button5 Name btnExit Text EXIT DataGridView Name DGV Radiobutton1 Name OPTJK RadioButton2 Name OPTJK2 Berikutkodingnyasbb: Imports System.Data.OleDb Public Class Pegawai Dim JK As String Sub tampilkan() da = New OleDbDataAdapter("select * from PEGAWAI", Conn) ds = New DataSet ds.Clear() da.Fill(ds, "PEGAWAI") DGV.DataSource = (ds.Tables("PEGAWAI")) DGV.ReadOnly = True End Sub Sub kosongkan() txtKOPEG.Enabled = True txtNAPEG.Enabled = True txtUsia.Enabled = True txtNAPEG.Text = "" txtUsia.Text = "" txtKOPEG.Focus() End Sub Private Sub Pegawai_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call Koneksi() Call tampilkan() txtKOPEG.Enabled = False txtNAPEG.Enabled = False txtUsia.Enabled = False btnDelete.Enabled = False btnEdit.Enabled = False btnSave.Enabled = False End Sub Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click Call kosongkan() End Sub Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click If txtKOPEG.Text = "" Then MsgBox("Isi kode Pegawai terlebih dahulu")
  • 3. txtKOPEG.Focus() Exit Sub Else If MessageBox.Show("Yakin akan dihapus..?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then cmd = New OleDbCommand("delete * from PEGAWAI where KOPEG = '" & txtKOPEG.Text & "'", Conn) cmd.ExecuteNonQuery() Call kosongkan() Call tampilkan() Else Call kosongkan() End If End If End Sub Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click If txtKOPEG.Text = "" Then MsgBox("Isi kode Pegawai terlebih dahulu") txtNAPEG.Focus() Exit Sub Else If MessageBox.Show("Yakin akan di Edit..?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then cmd = New OleDbCommand("update PEGAWAI set NAPEG ='" & txtNAPEG.Text & "', USIA =" & txtUsia.Text & ",JK='" & JK & "' where KOPEG = '" & txtKOPEG.Text & "'", Conn) cmd.ExecuteNonQuery() txtKOPEG.Text = "" Call kosongkan() Call tampilkan() Else Call kosongkan() End If End If End Sub Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click If MessageBox.Show("Yakin akan keluar..?", "", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then End End If End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click Dim sqltambah As String = "insert into PEGAWAI(KOPEG,NAPEG,USIA, JK) values " & _ "('" & txtKOPEG.Text & "','" & txtNAPEG.Text & "'," & txtUsia.Text & ",'" & JK & "')" cmd = New OleDbCommand(sqltambah, Conn) cmd.ExecuteNonQuery() txtKOPEG.Text = "" Call tampilkan() Call kosongkan() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Form2.Show() End Sub Private Sub OptJK_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OptJK.CheckedChanged If OptJK.Enabled = True Then JK = "L" End If End Sub
  • 4. Private Sub optJK2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optJK2.CheckedChanged If optJK2.Enabled = True Then JK = "P" End If End Sub Private Sub txtKOPEG_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtKOPEG.KeyPress Dim x As String If e.KeyChar = Chr(13) Then cmd = New OleDbCommand("select * from Pegawai where KOPEG='" & txtKOPEG.Text & "'", Conn) rd = cmd.ExecuteReader rd.Read() If rd.HasRows = True Then txtNAPEG.Text = rd.GetString(1) txtUsia.Text = rd.GetValue(2) x = rd.GetString(3) If x = "L" Then OptJK.Checked = True ElseIf x = "P" Then optJK2.Checked = True End If txtNAPEG.Focus() btnSave.Enabled = False btnEdit.Enabled = True btnDelete.Enabled = True Else Call kosongkan() txtNAPEG.Focus() btnSave.Enabled = True End If End If End Sub End Class