Guest User

form2.vb

a guest
Sep 10th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.81 KB | None | 0 0
  1. Public Class Form2
  2.     Public email As String
  3.     Public id_user As String = ""
  4.     Dim MySqlConn As MySqlConnection = New MySqlConnection("server=localhost;user id=root;password=programming;database=tugas")
  5.    
  6.    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  7.  
  8.         Dim Query As String
  9.  
  10.         MySqlConn.Open()
  11.         Query = "DELETE FROM user WHERE id_user ='" & id_user & "'", MySqlConn)
  12.      
  13.         Dim cmd As MySqlCommand = New MySqlCommand(Query, MySqlConn)
  14.         MsgBox(Query)
  15.         Dim i As Integer = cmd.ExecuteNonQuery()
  16.         If (i > 0) Then
  17.             MsgBox("Record is Successfully Deleted")
  18.         Else
  19.             MsgBox("Record is not Deleted")
  20.             End If
  21.         MySqlConn.Close()
  22.     End Sub
  23.  
  24. End Class
Add Comment
Please, Sign In to add comment