Hi i build a code that can insert my records to mysql database.. the codes are correct it can save records to the mysql database. Now i want to know is what code will i used that will show an error if the records already exist, so it will not make the same records again. here is my code for my INSERT code for mysql database
Code:
Imports MySql.Data.MySqlClient
Imports System.Data

Public Class Form2
    Dim connection As MySqlConnection


    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
        Dim mydata As MySqlDataReader
        mydata = command.ExecuteReader()
Need help please..