Hi.. all i need is a code to be inserted on these code.. i can save record to my mysql database but theres something wrong because i can save record with the same as the record inserted to my database.. all i want is a code that can detect if the record already exist then show an error and will not save , and a message that will appear that the record has been saved because it doesnt exist.. heres the code
Code:
Imports MySql.Data.MySqlClient


Public Class Form2
    Dim connection As MySqlConnection
    Dim ra As Integer


    Private Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click
        connection = New MySqlConnection()

        connection.ConnectionString = "server=localhost; user id=root; password=phoenix0931; database=accounts;"
        Try
            connection.Open()
        Catch MyError As MySqlException
            MessageBox.Show("Error in Connection to database; " & MyError.Message)
            Textbox1.Text = ""
            Textbox2.Text = ""
            Textbox1.Focus()
        End Try
        Dim myAdapter As New MySqlDataAdapter

        Dim sqlquery = "INSERT INTO users (Username, Password) Values('" & Textbox1.Text & "', '" & Textbox2.Text & "' )"

        Dim command As New MySqlCommand
        command.Connection = connection
        command.CommandText = sqlquery
          

        myAdapter.InsertCommand = command
        command.ExecuteNonQuery()
Please lend me a code