Click here to Skip to main content
15,902,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am new to VB.NET. I have an MS Access database and my Update and Delete queries do not work as I expect them to.

These are the queries I have now.

Update

SQL
Update Emp Set name="Project" Where no = 2;


Delete

SQL
Delete From Emp Where no=1;


Please help me. I know this is very basic stuff in VB.NET/Access but I don't know what to do next.
Posted
Updated 23-Feb-11 17:45pm
v3
Comments
Nish Nishant 23-Feb-11 23:46pm    
In what way do they not work? What's the error that you get?
sima2011 23-Feb-11 23:55pm    
You are about to update 0 rows
Once you click yes,you cant use the Undo command to reverse the changes,
Are you sure you want to update these records?
Nish Nishant 24-Feb-11 0:25am    
That's not an error. Your criteria just does not match any existing rows.

hello,

Try [no] instead of no. no is ODBC reserved keywords

Update Emp Set name='Project' Where [no] = 2;

http://msdn.microsoft.com/en-us/library/aa238507%28SQL.80%29.aspx[^]
 
Share this answer
 
Comments
Bryian Tan 24-Feb-11 0:29am    
oops, didn't see the question is for MS Access, anyway, using [no] should solve your puzzle.
sima2011 24-Feb-11 0:52am    
thank you so much sir
Bryian Tan 24-Feb-11 9:45am    
hi sima2011,

You're welcome. :)
Hope this[^] might hep you.
 
Share this answer
 
Comments
sima2011 23-Feb-11 23:43pm    
yes but this wizard through,i need sql query
I am not sure but use single quote like

SQL
Update Emp Set name='Project' Where no = 2;
 
Share this answer
 
Comments
m@dhu 24-Feb-11 0:44am    
Ah ok. In sql it will throw an error.Bryian's answer should work as no is a reserved keyword.
samir 2011 24-Feb-11 0:49am    
hmm that is true..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900