Hey You.docx

  • Uploaded by: Miftahul khair
  • 0
  • 0
  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Hey You.docx as PDF for free.

More details

  • Words: 574
  • Pages: 4
Rumus Module Imports MySql.Data.MySqlClient Module Module1 Public CONN As MySqlConnection Public DA As MySqlDataAdapter Public DS As New DataSet Public CMD As MySqlCommand Public DR As MySqlDataReader Public STR As String Public myData As DataTable Sub koneksi() Try Dim STR As String = "Server=localhost;user id=root;password=;database=tiket" CONN = New MySqlConnection(STR) If CONN.State = ConnectionState.Closed Then CONN.Open() End If Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub End Module rumus login Imports MySql.Data.MySqlClient Public Class Form1 Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If e.KeyChar = Chr(13) Then TextBox2.Focus() End If End Sub Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If e.KeyChar = Chr(13) Then Button1.Focus() End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Call koneksi() CMD = New MySqlCommand("select * from login where Nama='" & TextBox1.Text & "' and Password='" & TextBox2.Text & "'", CONN) DR = CMD.ExecuteReader DR.Read()

If Not DR.HasRows Then MsgBox("Login gagal") TextBox1.Clear() TextBox2.Clear() TextBox1.Focus() Else Me.Visible = False Form2.Show() End If End Sub End Class rumus input data Imports MySql.Data.MySqlClient Public Class Form3 Sub segar3() DGV4.Update() DGV4.Refresh() End Sub Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call segar3() End Sub Private Sub Form3_Activated(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Activated Call koneksi() DA = New MySqlDataAdapter("select * from user", CONN) DS = New DataSet DA.Fill(DS, "user") DGV4.DataSource = DS.Tables("user") End Sub Private Sub DGV4_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV4.CellContentClick Call segar3() End Sub Private Sub DGV4_CellMouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DGV4.CellMouseClick TextBox1.Text = DGV4.Rows(e.RowIndex).Cells(0).Value TextBox2.Text = DGV4.Rows(e.RowIndex).Cells(1).Value TextBox3.Text = DGV4.Rows(e.RowIndex).Cells(2).Value TextBox4.Text = DGV4.Rows(e.RowIndex).Cells(3).Value ComboBox1.Text = DGV4.Rows(e.RowIndex).Cells(4).Value TextBox6.Text = DGV4.Rows(e.RowIndex).Cells(5).Value

ComboBox2.Text = DGV4.Rows(e.RowIndex).Cells(6).Value TextBox8.Text = DGV4.Rows(e.RowIndex).Cells(7).Value TextBox1.Text = DGV4.Rows(e.RowIndex).Cells(0).Value TextBox2.Text = DGV4.Rows(e.RowIndex).Cells(1).Value TextBox3.Text = DGV4.Rows(e.RowIndex).Cells(2).Value TextBox4.Text = DGV4.Rows(e.RowIndex).Cells(3).Value ComboBox1.Text = DGV4.Rows(e.RowIndex).Cells(4).Value TextBox6.Text = DGV4.Rows(e.RowIndex).Cells(5).Value ComboBox2.Text = DGV4.Rows(e.RowIndex).Cells(6).Value TextBox8.Text = DGV4.Rows(e.RowIndex).Cells(7).Value Call segar3() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Call koneksi() Dim tambah As String Try tambah = "INSERT INTO user VALUES('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "')" CMD = New MySqlCommand(tambah, CONN) CMD.ExecuteNonQuery() If MsgBox("data tersimpan", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "Sukses") = MsgBoxResult.Ok Then TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox1.Focus() End If Catch ex As Exception If MsgBox("tambah gagal", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Gagal") = MsgBoxResult.Ok Then TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox2.Focus() End If End Try End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Call koneksi() Try DA = New MySqlDataAdapter("Update user set username='" & TextBox1.Text & "', password='" & TextBox2.Text & "', namalengkap= '" & TextBox3.Text & "', alamat= '" & TextBox4.Text & "', negara= '" & ComboBox1.Text & "',

kodepost= '" & TextBox6.Text & "', kota= '" & ComboBox2.Text & "', email= '" & TextBox8.Text & "'", CONN) DS = New DataSet DA.Fill(DS, "user") Call segar3() MsgBox("Data Telah di Upgrade") Catch ex As Exception Call segar3() MsgBox("Data Gagal di Upload") End Try End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Form2.Show() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Call koneksi() Try DS = New DataSet DA = New MySqlDataAdapter("delete from user where username='" & TextBox1.Text & "'", CONN) DA.Fill(DS, "user") Call segar3() MsgBox("Data telah Di Hapus") Catch ex As Exception Call segar3() MsgBox("Data Gagal Di Hapus") End Try End Sub End Class

Related Documents

Hey
June 2020 16
Hey!!
June 2020 13
Hey Joe_1_3
November 2019 30
Hey You.docx
April 2020 20
Hey Jude.pdf
June 2020 15
Hey, Aqualung
July 2020 13

More Documents from "Christopher Horton"