Update a specific row in a database

Jackson1998

Member
Joined
Jun 1, 2014
Messages
10
Programming Experience
1-3
I have a database table called "Items" that contains 4 data (ID, NAME, Count , Value )

what i want is : when i click a button All records in Value will be set to zero "0" .

i'm using MS access database . for updating one record that linked to a specific ID i used this query :

VB.NET:
[FONT=Verdana]"UPDATE `Items` SET `Value` = 0 where ID=?"[/FONT]
as a function and i called it Updatequery ,i called it in coding and it worked fine

for what i talked about above i used this query :
VB.NET:
[/FONT][FONT=Verdana]UPDATE `Items` SET `Value` = 0 "

but nothing happened .

BTW i display data on a Datagridview


thanks in advance
 
It's not possible that nothing happened. Either the code failed, in which case an exception was thrown, or it succeeded. If it succeeded then it would have told you how many records were affected, although you may not have looked. The method you called, which you haven't actually shown us, should have returned a number. What was that number?
 
an error msgbox pops up and says " syntax error in query , incomplete query clause "

so, what's wrong with that ? is my query correct ?? how to improve that
 
Obviously your query is not correct or you would not get that error message. Just to be clear, are you saying that:
VB.NET:
UPDATE `Items` SET `Value` = 0 where ID=?
worked and:
VB.NET:
UPDATE `Items` SET `Value` = 0
didn't? Can you show us the exact code you're using, i.e. the entire section that creates and executes the command?
 
Back
Top