0
votes

When I try and execute the following code to input a value into a text box it comes up with an error saying : Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'Adam-PC' (using password: NO)

Public Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles Datetxt.TextChanged Dim ConnectionString As String Dim con As New MySqlConnection

    ConnectionString = "server=localhost;user id=root;database=river_data;allowuservariables=True"";Integrated Security=True;MultipleActiveResultSets=True;"

    Dim cmd As MySqlCommand
    Dim query As String = "SELECT date FROM river-derwent-keswick-portinscale WHERE(`date` = '01.01.2013') "
    cmd = New MySqlCommand(query, con)
    con.Open()

    Dim myreader As MySqlDataReader = cmd.ExecuteReader()
    If myreader.Read() Then
        Datetxt.Text = myreader.GetValue(0)
    Else
        Me.Close()
        HomeForm.Show()
    End If
    myreader.Close()
1

1 Answers

0
votes
ConnectionString = "server=localhost;user id=root;database=river_data;allowuservariables=True"";Integrated Security=True;MultipleActiveResultSets=True;"

it looks like the user part is wrong. Try:

ConnectionString = "server=localhost;user=root;database=river_data;allowuservariables=True"";Integrated Security=True;MultipleActiveResultSets=True;"