Project Aplikasi Berbasis WEB Penjualan Motor

0 komentar Posted by ,
Project Aplikasi Berbasis WEB Penjualan Motor

Assalamualaikum wr.wb
hai guys ketemu lagi nih di aldiansya BLOG, kali ini saya akan membuat aplikasi berbasis web di aplikas visual studio dan dapat ditampilkan databasenya di microsoft access, yaudah nih tutornya dibawah yaa 

langkah awal untuk membuatnya terlebih dahulu membuat database tabel di microsoft access


seperti gambar diatas 

cuz kita langsung membuka aplikasi visual studio lalu membuat project web yaa kaya gambar dibawah ini 


lalu klik ok , lalu kasih nama project tersebut dengan nama sesuka kalian , 

 lalu klik kanan pada project yang sudah dibuat tadi seperti gambar diatas untuk membikin web form baru untuk membuat desainnya,


lalu kita menghubungkan visual studio dengan microsoft accses dengan cara pilik server exploler > lalu add connection > cari database accesnya yang dibuat tadi jika sudah klik OK 


lalu kita mambuat web form lagi untuk memuat tabel yang sudah dibuat di microsoft accses tadi,


jika sudah terconnect dengan databse microsoft accessnya klik table lalu kita drag and drop ke webform viewnya nanti akan seperti gambar diatas 

jika sudah kita mendesain di webfrom yang tadi kita buat 


seperti gambar diatas mendesainya, disini kita membutuhkan komponen dari toolbox yaitu, LABEL, TEXTBOX, dan BUTTON , jika sudah kita akan mengcoding button buttonya 

dibawah ini codingan untuk button save / menyimpan 

Protected Sub Bsave_Click(sender As Object, e As EventArgs) Handles Bsave.Click
        objekKoneksi.Open()
        Dim tambah As String = "INSERT INTO Tabelahuy values('" & Txtmerk.Text & "','" & Txtmesin.Text & "','" & Txtjenis.Text & "','" & Txtwarna.Text & "','" & Txttype.Text & "','" & Txtharga.Text & "') "
        Dim oCmd = New OleDbCommand(tambah, objekKoneksi)
        oCmd.ExecuteNonQuery()
        objekKoneksi.Close()
        MsgBox("Ahuy")
    End Sub 

dibawah ini untuk codingan button cari 

Protected Sub Bcari_Click(sender As Object, e As EventArgs) Handles Bcari.Click
        If Not Len(Txtmerk.Text) = 0 Then
            objekKoneksi.Close()
            objekKoneksi.Open()
            Dim ocmd As New OleDb.OleDbCommand("SELECT * FROM Tabelahuy where Merk='" + Txtmerk.Text + "'", objekKoneksi)
            Xreader = ocmd.ExecuteReader()
            If Xreader.HasRows Then
                Xreader.Read()
                Txtmerk.Text = Xreader("Merk")
                Txtmesin.Text = Xreader("Mesin")
                Txtjenis.Text = Xreader("Jenis")
                Txtwarna.Text = Xreader("Warna")
                Txttype.Text = Xreader("Type")
                Txtharga.Text = Xreader("Harga")
            Else
                Txtmerk.Text = "Nama Motor Tiada"
                Exit Sub
            End If
            Xreader.Close()
            MsgBox("Alhamdullilah")
        End If
    End Sub

dibawah ini codingan untuk codingan button view

 Protected Sub Bview_Click(sender As Object, e As EventArgs) Handles Bview.Click
        Response.Redirect("WebformViews.aspx")
    End Sub
End Class

dibawah ini untuk codingan button update 

 Protected Sub Bupdate_Click(sender As Object, e As EventArgs) Handles Bupdate.Click
        objekKoneksi.Open()
        Dim Rubah As String = "UPDATE Tabelahuy set Warna ='" + Txtwarna.Text + "' where Merk='" + Trim(Txtmerk.Text) + "'"
        Dim oCmd = New OleDbCommand(Rubah, objekKoneksi)
        oCmd.ExecuteNonQuery()
        objekKoneksi.Close()
        MsgBox("Sukses")
    End Sub

dibawah ini codingan untuk button delete 

Protected Sub Bhapus_Click(sender As Object, e As EventArgs) Handles Bhapus.Click
        Txtmerk.Text = ""
        Txtmesin.Text = ""
        Txtjenis.Text = ""
        Txtwarna.Text = ""
        Txttype.Text = ""
        Txtharga.Text = ""
        Txtmerk.Focus()
    End Sub

dibawah ini ketika saya menjalankan projectnya 

ini ketika button savenya dijalankan 

ini ketika button update dijalankan 


ini ketika button view dijalankan 


ini ketika button cari saya jalankan 


ini button deletenya ketika saya jalankan 



Berikut semua codingannya :

Imports System.Data
Imports System.Data.OleDb


Public Class WebformAhuy
    Inherits System.Web.UI.Page
    Dim Koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Aldiansya\Database1.accdb"
    Dim objekKoneksi As New OleDb.OleDbConnection(Koneksi)
    Dim Xreader As OleDb.OleDbDataReader
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Bsave_Click(sender As Object, e As EventArgs) Handles Bsave.Click
        objekKoneksi.Open()
        Dim tambah As String = "INSERT INTO Tabelahuy values('" & Txtmerk.Text & "','" & Txtmesin.Text & "','" & Txtjenis.Text & "','" & Txtwarna.Text & "','" & Txttype.Text & "','" & Txtharga.Text & "') "
        Dim oCmd = New OleDbCommand(tambah, objekKoneksi)
        oCmd.ExecuteNonQuery()
        objekKoneksi.Close()
        MsgBox("Ahuy")
    End Sub

    Protected Sub Bcari_Click(sender As Object, e As EventArgs) Handles Bcari.Click
        If Not Len(Txtmerk.Text) = 0 Then
            objekKoneksi.Close()
            objekKoneksi.Open()
            Dim ocmd As New OleDb.OleDbCommand("SELECT * FROM Tabelahuy where Merk='" + Txtmerk.Text + "'", objekKoneksi)
            Xreader = ocmd.ExecuteReader()
            If Xreader.HasRows Then
                Xreader.Read()
                Txtmerk.Text = Xreader("Merk")
                Txtmesin.Text = Xreader("Mesin")
                Txtjenis.Text = Xreader("Jenis")
                Txtwarna.Text = Xreader("Warna")
                Txttype.Text = Xreader("Type")
                Txtharga.Text = Xreader("Harga")
            Else
                Txtmerk.Text = "Nama Motor Tiada"
                Exit Sub
            End If
            Xreader.Close()
            MsgBox("Alhamdullilah")
        End If
    End Sub

    Protected Sub Bupdate_Click(sender As Object, e As EventArgs) Handles Bupdate.Click
        objekKoneksi.Open()
        Dim Rubah As String = "UPDATE Tabelahuy set Warna ='" + Txtwarna.Text + "' where Merk='" + Trim(Txtmerk.Text) + "'"
        Dim oCmd = New OleDbCommand(Rubah, objekKoneksi)
        oCmd.ExecuteNonQuery()
        objekKoneksi.Close()
        MsgBox("Sukses")
    End Sub

    Protected Sub Bhapus_Click(sender As Object, e As EventArgs) Handles Bhapus.Click
        Txtmerk.Text = ""
        Txtmesin.Text = ""
        Txtjenis.Text = ""
        Txtwarna.Text = ""
        Txttype.Text = ""
        Txtharga.Text = ""
        Txtmerk.Focus()
    End Sub

    Protected Sub Bview_Click(sender As Object, e As EventArgs) Handles Bview.Click
        Response.Redirect("WebformViews.aspx")
    End Sub
End Class

yaa sekian dari penjelasan saya semoga bermanfaat yaa terima kasih sebelumnya , see you next time 

^^ salam hangat ^^

Related Post :

0 Comments for "Project Aplikasi Berbasis WEB Penjualan Motor "