Guest User

Untitled

a guest
Feb 13th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. Imports System.Data.SqlClient
  2.  
  3. Dim connection As New SqlConnection("datasource=localhost;port=3306;username=root;password=;database=bukuakaunrumah")
  4. Dim command As New SqlCommand
  5.  
  6. Private Sub FormDatabaseMySQL_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  7.  
  8.  
  9.  
  10. End Sub
  11.  
  12. Private Sub ButtonBack_Click(sender As Object, e As EventArgs) Handles ButtonBack.Click
  13. Me.Hide()
  14. FormFront.Show()
  15.  
  16. End Sub
  17.  
  18. Private Sub ButtonSubmit_Click(sender As Object, e As EventArgs) Handles ButtonSubmit.Click
  19. Dim command As New SqlCommand("INSERT INTO `accountinfo`(`AccountID`, `AccountName`, `AccountPassword`) VALUES (@accountID,@accountName,@accountPassword)", connection)
  20.  
  21. command.Parameters.Add("@AccountID", SqlDbType.VarChar).Value = TextBoxID.Text
  22. command.Parameters.Add("@AccountName", SqlDbType.VarChar).Value = TextBoxName.Text
  23. command.Parameters.Add("@AccountPassword", SqlDbType.VarChar).Value = TextBoxPassword.Text
  24.  
  25. connection.Open()
  26.  
  27. If command.ExecuteNonQuery() = 1 Then
  28.  
  29. MessageBox.Show("Successful Registered", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
  30.  
  31. Else
  32. MessageBox.Show("Error")
  33.  
  34.  
  35. End If
  36. connection.Close()
  37.  
  38.  
  39. End Sub
  40. End Class
Add Comment
Please, Sign In to add comment