Tahapan Normalisasi
1NF
Table_SewaMusik (ID_Penyewa, Nama_Penyewa, ID_AlatMusik, Nama_AlatMusik, Tipe_Harga, Sewa_Perhari)
2NF
Table_SewaMusik (ID_Penyewa, Nama_Penyewa, ID_AlatMusik, Tipe_Harga)
Table_Merk (ID_AlatMusik, Nama_AlatMusik)
Table_TipeHarga (Tipe_Harga, Sewa_Perhari)
*note: 3NF sama dengan 2NF
Berikut Screenshot:
 |
Table_SewaMusik |
 |
Table_Merk |
 |
Table_TipeHarga |
 |
Table_Penyewaan |
 |
Relationships
Source Code
Imports System.Data
Imports System.Data.OleDb
Public Class WebForm1
Inherits System.Web.UI.Page
Public constring As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
Public oConn As New OleDbConnection(constring)
Public oTbl As New DataTable
Public xReader As OleDbDataReader
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sql As String = "INSERT INTO Table_SewaMusik VALUES ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "')"
Dim oCmd As New OleDbCommand
oConn.Open()
oCmd.Connection = oConn
oCmd.CommandText = sql
oCmd.ExecuteNonQuery()
End Sub
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim hapus = MsgBox("Anda Yakin", MsgBoxStyle.YesNo, "Hapus")
If hapus = vbYes Then
oConn.Close()
oConn.Open()
Dim delet As String = "DELETE FROM Table_SewaMobil where ID_Penyewa =" + TextBox1.Text + ""
Dim oCmd As New OleDbCommand
oConn.Close()
oConn.Open()
oCmd.Connection = oConn
oCmd.CommandText = delet
oCmd.ExecuteNonQuery()
MsgBox("Sudah terhapus", vbArchive)
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End If
End Sub
Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim sql As String = " UPDATE Table_SewaMusik set Nama_Penyewa ='" & TextBox2.Text & "', ID_AlatMusik = " & TextBox3.Text & ", Tipe_Harga = '" & TextBox4.Text & "' where ID_Penyewa = " & TextBox1.Text & ""
Dim oCmd As New OleDbCommand
oConn.Close()
oConn.Open()
oCmd.Connection = oConn
oCmd.CommandText = sql
oCmd.ExecuteNonQuery()
End Sub
End Class
|
Tidak ada komentar:
Posting Komentar