You are on page 1of 4

NAMA :MIA WULANSARI

NO BP :19101152600048
Pertemuan :7

SCREEN HASIL PROGRAM

1.Tampilan Projek
2.Tampilan Form

3.Koding Program

A.Form
Imports MySql.Data.MySqlClient

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click
Try
sql = "insert into tblbuku values('" & TXTKDBUKU.Text &
"','" & TXTJUDULBUKU.Text & "','" & CMBJENISBUKU.Text & "','" &
TXTPENGARANG.Text &
"','" & TXTPENERBIT.Text & "','" & TXTHARGA.Text & "')"

Cmd = New MySqlCommand(sql, conn)


Cmd.ExecuteNonQuery()
MsgBox("Data Berhasil Dismpan")

Catch ex As Exception

End Try
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles GroupBox1.Enter

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles MyBase.Load
dskoneksi()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
TXTKDBUKU.Text = ""
TXTJUDULBUKU.Text = ""
TXTPENGARANG.Text = ""
TXTPENERBIT.Text = ""
TXTHARGA.Text = ""
TXTKDBUKU.Focus()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
Me.Close()
End Sub
End Class

B.Koneksi
Imports MySql.Data.MySqlClient
Imports System.Data.OleDb
Module Koneksi
Public conn As MySqlConnection
Public Cmd As MySqlCommand
Public str, sql As String
Public Sub dskoneksi()
str = "server=localhost;user=root;database=dbtokobuku"
conn = New MySqlConnection(str)
If conn.State = ConnectionState.Closed Then conn.Open()
End Sub

End Module
4.Hasil Running Program

You might also like