Hey, I'm new to the forums and well I've managed to make a login user form that uses mysql database.
now i wanted to make a register form as well, but i can't seem to figure out how i do that.
so, can anyone help me out?
here's my login form.
Code:My.Computer.Audio.Play(My.Resources.button1, AudioPlayMode.Background) Dim conn As MySqlConnection 'connect to DB conn = New MySqlConnection() conn.ConnectionString = "server=127.0.0.1; user id=root; password=test; database=users" 'see if connection failed. Try conn.Open() Catch myerror As MySqlException MessageBox.Show("Error Connecting to Database") Close() End Try 'sql query Dim myAdapter As New MySqlDataAdapter Dim sqlquery = "SELECT username, password FROM accounts Where username='" & TextBox1.Text & "' and password='" & TextBox2.Text & "'" Dim myCommand As New MySqlCommand() myCommand.Connection = conn myCommand.CommandText = sqlquery 'start query myAdapter.SelectCommand = myCommand Dim myData As MySqlDataReader myData = myCommand.ExecuteReader() 'if nothing is entered into the textboxes If TextBox1.Text = "" Then MsgBox("Please Enter your Username") My.Computer.Audio.Play(My.Resources.button1, AudioPlayMode.Background) End If If TextBox2.Text = "" Then My.Computer.Audio.Play(My.Resources.button1, AudioPlayMode.Background) MsgBox("Please Enter your Password") Else End If 'see if user exits. If myData.HasRows = 0 Then MessageBox.Show("The information that has been entered appears to be invalid.", "Vbphysics", MessageBoxButtons.OK, MessageBoxIcon.Error) My.Computer.Audio.Play(My.Resources.button1, AudioPlayMode.Background) Else Dim form2 = New Form2 form2.Show() Me.Visible = False End If End Sub




Reply With Quote