Editing Database Tables Question/Problem.

Posted 05 October 2012 - 10:08 AM

Hello, i'm trying to make my program change a value in a database.
I've got a database called Account, and a Table called Accounts. I have 4 columns in this table. Id(Key column), UserName, Password and Adminpower.
What I am trying to do is to make a button change a value in that table. What I do not know is how to make the program know which row i want to change the value in.

That's the code so far for the button. So what I want it to do is to change the Adminpower column from 0 to 1 when pressing that button. Yes I have already connected it to the database.
When I try to press the button I get an error saying that the table doesn't exist.

Re: Editing Database Tables Question/Problem.

Posted 05 October 2012 - 10:26 AM

In your cmd.Text, you need to tell WHERE you want to UPDATE the table row. For example: UPDATE 'Accounts' SET 'Adminpower' = 1 WHERE 'UserName' = "YourUserName" AND 'Password' = "YourPassword". Later you might want to look at parameterized queries.

Re: Editing Database Tables Question/Problem.

Posted 05 October 2012 - 10:42 AM

lucky3, on 05 October 2012 - 10:26 AM, said:

In your cmd.Text, you need to tell WHERE you want to UPDATE the table row. For example: UPDATE 'Accounts' SET 'Adminpower' = 1 WHERE 'UserName' = "YourUserName" AND 'Password' = "YourPassword". Later you might want to look at parameterized queries.

Thank you! I got it working by editing your post a little. It worked with