Kamis, 25 Mei 2017

UAS LAB SMBD

Aplikasi ini digunakan untuk pihak management hotel untuk menyimpan data dari konsumennya. dalam aplikasi ini hotel dapat insert, delete,update,view, dan search





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_Konsumen VALUES ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.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("Authentication", MsgBoxStyle.YesNo, "Delete")


        If hapus = vbYes Then
            oConn.Close()
            oConn.Open()
            Dim delet As String = "DELETE FROM Table_Konsumen where IDKonsumen ='" + 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 = ""
            TextBox5.Text = ""


        End If


    End Sub

    Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Response.Redirect("WebForm2.aspx")


    End Sub

    Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim sql As String = " UPDATE Table_Hotel set KodeHotel ='" & TextBox1.Text & "', KodeKamar = '" & TextBox2.Text & "', NamaKonsumen = '" & TextBox4.Text & "', Status = '" & TextBox5.Text & "' where IDKonsumen = '" & TextBox1.Text & "' "

        Dim oCmd As New OleDbCommand
        oConn.Close()
        oConn.Open()
        oCmd.Connection = oConn
        oCmd.CommandText = sql

        oCmd.ExecuteNonQuery()


    End Sub

    Protected Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        oConn.Close()
        oConn.Open()
        Dim Cmd As New OleDbCommand("SELECT * FROM Table_Konsumen where IDKonsumen ='" + TextBox1.Text + "'", oConn)
        xReader = Cmd.ExecuteReader
        If xReader.HasRows Then
            xReader.Read()
            TextBox2.Text = xReader("KodeHotel")
            TextBox3.Text = xReader("KodeKamar")
            TextBox4.Text = xReader("NamaKonsumen")
            TextBox5.Text = xReader("Status")




        Else
            MsgBox("Consumer Not Found")
            TextBox1.Text = ""
            TextBox2.Text = ""
            TextBox3.Text = ""
            TextBox4.Text = ""
            TextBox5.Text = ""


            Exit Sub
        End If
        xReader.Close()

    End Sub
End Class



Kamis, 06 April 2017

UTS LAB SMBD






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
    Dim 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 = " UPDATE Table_Buku set NamaBuku  ='" & TextBox1.Text & "', IdBuku = " & TextBox2.Text & ", NamaPenerbit = '" & TextBox3.Text & "' where NamaBuku = " & TextBox1.Text & ""

        Dim oCmd As New OleDbCommand
        oConn.Close()
        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 sql As String = "INSERT INTO Table_Buku 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 Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim hapus = MsgBox("Konfirmasi", MsgBoxStyle.YesNo, "Hapus")

        If hapus = vbYes Then
            oConn.Close()
            oConn.Open()
            Dim delet As String = "DELETE FROM Table_Pembelian where Kode_Pembelian =" + TextBox3.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 Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        oConn.Close()
        oConn.Open()
        Dim Cmd As New OleDbCommand("SELECT * FROM Table_Pembelian where Kode_Pembelian =" + TextBox3.Text + "", oConn)
        xReader = Cmd.ExecuteReader
        If xReader.HasRows Then
            xReader.Read()
            TextBox2.Text = xReader("IdBuku")
            TextBox3.Text = xReader("NamaPenerbit")
            TextBox4.Text = xReader("KodePengarang")


        Else
            MsgBox("Kode Buku Tidak Ada")
            TextBox1.Text = ""
            TextBox2.Text = ""
            TextBox3.Text = ""
            TextBox4.Text = ""

            Exit Sub
        End If
        xReader.Close()
    End Sub
End Class

Rabu, 14 Desember 2016

UAS PEMROGRAMAN BISNIS 2

Penjelasan

aplikasi yang saya buat ini adalah aplikasi untuk apotek yang dapat digunakan dua mode. mode pertama yaitu moder admin. dalam mode ini anda dapat edit,delete,add,view,find, dan close. sedangkan dalam mode user anda hanya bisa melihat saja

FORM:




Source Code
Form 1
Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If RadioButton1.Checked Then
            Form2.Show()
            Me.Hide()
        ElseIf RadioButton2.Checked Then
            Form4.Show()
            Me.Hide()


        End If

    End Sub
End Class

Form 2
Public Class Form2

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If TextBox1.Text = "Admin" Then
            TextBox2.Text = "admin1"
            Form3.Show()
            Me.Hide()


        End If
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Form1.Close()
    End Sub
End Class

Form 3
Imports System.Data
Imports System.Data.Sql
Imports System.Data.OleDb

Public Class Form3
    Dim connection As String = "Provider=Microsoft.ACE.OLEDB.12.0; DATA Source=D:\Database\Database1.accdb"
    Dim objekkoneksi As New OleDb.OleDbConnection(connection)
    Dim xreader As OleDbDataReader

    Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        objekkoneksi.Close()
        objekkoneksi.Open()
        Dim add As String = "INSERT INTO tableobat values('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & ComboBox1.Text & "')"
        Dim ocmd = New OleDbCommand(add, objekkoneksi)
        ocmd.ExecuteNonQuery()
        objekkoneksi.Close()
        MsgBox("Berhasil")

        Form4.Show()

    End Sub

    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        Dim Vkode = InputBox("Enter Code")

        objekkoneksi.Close()
        objekkoneksi.Open()
        Dim Cmd As New OleDbCommand("SELECT * FROM tableobat where kodesupplier ='" + Vkode + "'", objekkoneksi)
        xreader = Cmd.ExecuteReader

        If xreader.HasRows Then
            xreader.Read()
            TextBox1.Text = xreader("kodesupplier")
            TextBox2.Text = xreader("namasuplier")
            TextBox3.Text = xreader("namabarang")
            TextBox4.Text = xreader("harga")
            TextBox5.Text = xreader("jumlah")
            ComboBox1.Text = xreader("keterangan")
        Else
            MsgBox("Code not Found")
            TextBox1.Text = ""
            TextBox2.Text = ""
            TextBox3.Text = ""
            TextBox4.Text = ""
            TextBox5.Text = ""
            ComboBox1.Text = ""
            TextBox1.Focus()
            Exit Sub
        End If
        xreader.Close()

    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim DELETE As Integer
        DELETE = MsgBox("Confirmation", MsgBoxStyle.OkCancel)
        If vbOK Then

            objekkoneksi.Close()
            objekkoneksi.Open()
            Dim sql As String = "DELETE from tableobat where namasuplier= '" + TextBox2.Text + "'"
            Dim ocmd As New OleDbCommand
            objekkoneksi.Close()
            objekkoneksi.Open()
            ocmd.Connection = objekkoneksi
            ocmd.CommandText = sql
            ocmd.ExecuteNonQuery()
            TextBox1.Text = ""
            TextBox2.Text = ""
            TextBox3.Text = ""
            TextBox4.Text = ""
            TextBox5.Text = ""
            ComboBox1.Text = ""
        End If
    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Dim sql As String = " Update tableobat set namasuplier='" + TextBox2.Text + "', namabarang = '" + TextBox3.Text + "', harga ='" + TextBox4.Text + "', jumlah ='" + TextBox5.Text + "', keterangan = '" + ComboBox1.Text + "'where kodesupplier = '" + TextBox1.Text + "'"
        Dim oCmd As New OleDbCommand
        objekkoneksi.Close()
        objekkoneksi.Open()
        oCmd.Connection = objekkoneksi
        oCmd.CommandText = sql
        oCmd.ExecuteNonQuery()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Form4.Show()
    End Sub

    Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
        Me.Close()
    End Sub

    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click


    End Sub
End Class


Minggu, 16 Oktober 2016

UTS LAB PEMBIS 2

Penjelasan :

aplikasi ini adalah aplikasi pemesanan tiket andromeda airways. karena airways ini baru jadi hanya melayani sekali penerbangan saja. bila ditekan tombol BOOK NOW maka langsung terproses dan menyambung ke word dan excel


Screenshot








Source Code

Public Class Form1
    Dim excelapp As New Microsoft.Office.Interop.Excel.Application
    Dim myexcelbook As Microsoft.Office.Interop.Excel.Workbook
    Dim wordapp As New Microsoft.Office.Interop.Word.Application
    Dim myword As Microsoft.Office.Interop.Word.Document

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        myexcelbook = excelapp.Workbooks.Open("D:\ANDROMEDA AIRWAYS.xlsx")
        excelapp.Range("A2").Value = TextBox1.Text
        excelapp.Range("B2").Value = ComboBox1.Text
        excelapp.Range("C2").Value = TextBox4.Text
        excelapp.Range("D2").Value = TextBox2.Text
        excelapp.Range("E2").Value = TextBox3.Text
        excelapp.Range("F2").Value = TextBox5.Text

        myexcelbook.SaveAs("D:\ANDORMEDA AIRWAYS2.xlsx")
        excelapp.Visible = True

        myword = wordapp.Documents.Open("D:\\RESERVATION ANDROMEDA AIRWAYS.docx")
        myword.Bookmarks("NAME").Select()
        wordapp.Selection.TypeText(TextBox1.Text)
        myword.Bookmarks("GENDER").Select()
        wordapp.Selection.TypeText(ComboBox1.Text)
        myword.Bookmarks("PHONE").Select()
        wordapp.Selection.TypeText(TextBox4.Text)
        myword.Bookmarks("DESTINATION").Select()
        wordapp.Selection.TypeText(ComboBox2.Text)
        myword.Bookmarks("DEPARTURE").Select()
        wordapp.Selection.TypeText(DateTimePicker2.Text)
        myword.Bookmarks("CLASS").Select()
        wordapp.Selection.TypeText(ComboBox3.Text)
        If ComboBox3.Text = "PREMIUM" Then
            TextBox6.Text = "15000000"
        ElseIf ComboBox3.Text = "BUSINESS" Then
            TextBox6.Text = "10000000"
        ElseIf ComboBox3.Text = "ECONOMY" Then
            TextBox6.Text = "5000000"
        End If
        TextBox7.Text = (TextBox6.Text * 0.05)
        Dim total As Integer
        total = Val(TextBox6.Text) + Val(TextBox7.Text)
        TextBox8.Text = total
        myword.Bookmarks("TOTAL").Select()
        wordapp.Selection.TypeText(TextBox8.Text)
        myword.SaveAs2("D:\\" + TextBox1.Text + ".docx")
        wordapp.Visible = True


    End Sub

    Private Sub DateTimePicker2_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker2.ValueChanged

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""
        TextBox7.Text = ""
        TextBox8.Text = ""
        ComboBox1.Text = ""
        ComboBox2.Text = ""
        ComboBox3.Text = ""
    End Sub
End Class

Selasa, 07 Juni 2016

UAS LAB Pemrograman Bisnis

Aplikasi ini adalah aplikasi reservasi hotel. dimana terdapat beberapa jenis hotel yang dapat dipilih



Untuk lebih jelas nya mari kita lihat video dibawah ini 


Source Code 
Public Class Form1

    
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ComboBox1.Text = ""
        ComboBox2.Text = ""
        ComboBox3.Text = ""
        Label6.Text = ""
        Label7.Text = ""
        ListBox1.Text = ""

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim Harga As Integer
        If ComboBox2.Text = "Single" Then
            Harga = 1500000
        ElseIf ComboBox2.Text = "Double" Then
            Harga = 2000000
        End If

        Label6.Text = Harga * ComboBox3.Text
        Label7.Text = (0.1 * (Val(Label6.Text))) + (Harga * ComboBox3.Text)
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Dim var6 As Object
        Dim var5 As Object
        Dim var4 As Object
        Dim var3 As Object
        Dim var2 As Object
        Dim var1 As Object
        Dim nofile As Object
        Dim harga As Integer
        nofile = FreeFile()
        FileOpen(nofile, "D:\Hotel.CSV", OpenMode.Append)
        var1 = ComboBox1.Text
        var2 = DateTimePicker1.Text
        var3 = ComboBox2.Text
        var4 = ComboBox3.Text
        var5 = Harga * ComboBox3.Text
        var6 = (0.1 * (Val(Label6.Text))) + (harga * ComboBox3.Text)
        Label6.Text = var5
        Label7.Text = var6

        ListBox1.Items.Add(var1 & "---" & var2 & "---" & var3 & "---" & var4 & "---" & var5 & "---" & var6 & "---")
        WriteLine(1, var1, var2, var3, var4, var5, var6)
        FileClose(1)



    End Sub

    
End Class


Jumat, 03 Juni 2016

Tugas Buka Tambah Hapus Access


berikut adalah source code buka tambah access
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SulthanAndromeda_1506760990_bktmbhexcelaccs
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            System.Data.OleDb.OleDbConnection MyConnection;
            System.Data.DataSet DtSet;
            System.Data.OleDb.OleDbDataAdapter MyCommand;

            openFileDialog1.ShowDialog();
            MyConnection = new System.Data.OleDb.OleDbConnection(@"provider=Microsoft.Jet.OLEDB.4.0;Data Source='"
             + openFileDialog1.FileName.ToString() + "';Extended Properties=Excel 8.0;");
            MyCommand = new System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection);
            MyCommand.TableMappings.Add("Table", "Net-informations.com");
            DtSet = new System.Data.DataSet();
            MyCommand.Fill(DtSet);
            dataGridView1.DataSource = DtSet.Tables[0];
            MyConnection.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            dataGridView1.ColumnCount = 2;
            dataGridView1.Columns[0].Name = "Nama";
            dataGridView1.Columns[1].Name = "Alamat";
            //int baris = System.Convert.ToInt32(textBox1.Text);
            string nama = System.Convert.ToString(textBox2.Text);
            string alamat = System.Convert.ToString(textBox3.Text);
            string[] row = new string[] { nama, alamat };

            dataGridView1.Rows.Add(row);
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}


Tugas Buka Tambah Excel dan Access

Berikut adalah design dari databasenya