2
Answers

Update in access database

abed akhi

abed akhi

12y
1.4k
1
Hi,

I am trying to update a column with the access databse it has been 2 hours now with no result I am writing different update queries and either I am getting syntax error in the update statement or they are updating my column but adding 0 in the place of the older value although that I am specifying a value, what's the problem how can I update a value with the access database using C#?

thanks.
Answers (2)
0
Vulpes
NA 98.3k 1.5m 12y
Although I knew that Password was a reserved word in MS Access I didn't know that Username was. See list here:

http://support.microsoft.com/kb/321266 

However, it's good practice (and never does any harm) to enclose all your field names in square brackets just in case they happen to be reserved words :)
Accepted
10
abed akhi
NA 57 23.5k 12y
finally I knew where the problem was I needed to add [] to the columns name:
string edit = @"UPDATE Users SET [Password] = '" + TextBox2.Text + "' WHERE [Username] ='" + TextBox1.Text+"'";

thanks.