Results 1 to 2 of 2

Thread: [RESOLVED] Editing a cell in MySQL database?

  1. #1
    Junior Member
    Join Date
    Jan 12
    Posts
    29

    [RESOLVED] Editing a cell in MySQL database?

    Hey guys, I have a question regarding table cell editing (I think)?

    What I want to do, is make an account password changer. I've already got registering and login sorted and thought this would be a nice additional feature.
    I want it to change the value of the cell in the 'Password' in the row of the set 'accountName'.

    I've tried the below code, and it seems to change the correct cell, but it inputs a different value.
    Say I replace "newPass.Text" with "12345", the cell in the table will change it's value to "*85D0F19E5598AC04AC7B3FCF"?

    Code:
    Dim SqlQuery = "UPDATE Users SET Password=password('" & newPass.Text & "') where Username='" & accountName & "'"
    Is this my fault, have I gone wrong somewhere? Thanks.

    Whole code the the Sub:

    Code:
    Private Sub changePassword()
            MySqlConnection = New MySqlConnection
            MySqlConnection.ConnectionString = serverString
            MySqlConnection.Open()
    
            Dim MyAdapter As New MySqlDataAdapter
            Dim SqlQuery = "UPDATE Users SET Password=password('" & newPass.Text & "') where Username='" & accountName & "'"
            Dim Command As New MySqlCommand
            Command.Connection = MySqlConnection
            Command.CommandText = SqlQuery
            MyAdapter.SelectCommand = Command
            Dim MyData As MySqlDataReader
            MyData = Command.ExecuteReader
    
        End Sub
    Last edited by ComYOU; Aug 19th, 2012 at 03:23 PM.

  2. #2
    Junior Member
    Join Date
    Jan 12
    Posts
    29

    Re: Editing a cell in MySQL database?

    Fixed it, turns out the brackets around the newPass.Text didn't need to be there!

    Code:
    Dim SqlQuery = "UPDATE Users SET Password='" & newPass.Text & "' where Username='" & accountName & "'"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •