Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysqlConn.Open()
- sqlCmd = New Odbc.OdbcCommand
- sqlCmd.Connection = mysqlConn
- sqlCmd.CommandText = "SELECT * FROM tbl_user WHERE username = '" & Replace(TextBox01.Text, "'", "''") & "' AND password = '" & Replace(TextBox02.Text, "'", "''") & "' "
- dr = sqlCmd.ExecuteReader
- dr.Read()
- Try
- getUsername = dr("username")
- MessageBox.Show("You are now login!", "System", MessageBoxButtons.OK, MessageBoxIcon.Information)
- Me.Hide()
- frmMenu.Show()
- TextBox01.Text = ""
- TextBox02.Text = ""
- mysqlConn.Close()
- Catch ex As Exception
- MessageBox.Show("Invalid Username or Password!", "System", MessageBoxButtons.OK, MessageBoxIcon.Error)
- TextBox01.Focus()
- End Try
- mysqlConn.Open()
- Dim myQuery As String
- 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), "'", "''") & "')"
- sqlCmd = New Odbc.OdbcCommand
- sqlCmd.Connection = mysqlConn
- sqlCmd.CommandText = myQuery
- dr = sqlCmd.ExecuteReader
- mysqlConn.Close()
- MessageBox.Show("You are now register!", "System", MessageBoxButtons.OK, MessageBoxIcon.Information)
- Me.Hide()
- frmMenu.Hide()
- frmLogin.Show()
Add Comment
Please, Sign In to add comment