Guest User

Untitled

a guest
Jun 28th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. mysqlConn.Open()
  2. sqlCmd = New Odbc.OdbcCommand
  3. sqlCmd.Connection = mysqlConn
  4. sqlCmd.CommandText = "SELECT * FROM tbl_user WHERE username = '" & Replace(TextBox01.Text, "'", "''") & "' AND password = '" & Replace(TextBox02.Text, "'", "''") & "' "
  5. dr = sqlCmd.ExecuteReader
  6. dr.Read()
  7.  
  8. Try
  9. getUsername = dr("username")
  10. MessageBox.Show("You are now login!", "System", MessageBoxButtons.OK, MessageBoxIcon.Information)
  11. Me.Hide()
  12. frmMenu.Show()
  13.  
  14. TextBox01.Text = ""
  15. TextBox02.Text = ""
  16. mysqlConn.Close()
  17. Catch ex As Exception
  18. MessageBox.Show("Invalid Username or Password!", "System", MessageBoxButtons.OK, MessageBoxIcon.Error)
  19. TextBox01.Focus()
  20. End Try
  21.  
  22. mysqlConn.Open()
  23. Dim myQuery As String
  24. myQuery = "INSERT INTO tbl_user(firstname, lastname, address, email, username, password) VALUES ('" & Replace(Trim(TextBox01.Text), "'", "''") & "', '" & Replace(Trim(TextBox02.Text), "'", "''") & "', '" & Replace(Trim(TextBox03.Text), "'", "''") & "', '" & Replace(Trim(TextBox04.Text), "'", "''") & "', '" & Replace(Trim(TextBox05.Text), "'", "''") & "', '" & Replace(Trim(TextBox06.Text), "'", "''") & "')"
  25.  
  26. sqlCmd = New Odbc.OdbcCommand
  27. sqlCmd.Connection = mysqlConn
  28. sqlCmd.CommandText = myQuery
  29. dr = sqlCmd.ExecuteReader
  30. mysqlConn.Close()
  31. MessageBox.Show("You are now register!", "System", MessageBoxButtons.OK, MessageBoxIcon.Information)
  32. Me.Hide()
  33. frmMenu.Hide()
  34. frmLogin.Show()
Add Comment
Please, Sign In to add comment