Update statement not working for VB->Access

A

Anil Gupte

This statement:
Update Profiles set ProfileName='Kids', Current=True,
ProfileDescription='Kids', Password='Kids' where ProfileID=2
as also:
Update Profiles set ProfileName='Kids', Current=Yes,
ProfileDescription='Kids', Password='Kids' where ProfileID=2

works within Access. But neither of the above statements work when using
them from VB. I get a "Syntax Error in Update command."

Also, Insert statements into the same database, same program work fine.

Help!

TIA,
 
A

Armin Zingler

Anil Gupte said:
This statement:
Update Profiles set ProfileName='Kids', Current=True,
ProfileDescription='Kids', Password='Kids' where ProfileID=2
as also:
Update Profiles set ProfileName='Kids', Current=Yes,
ProfileDescription='Kids', Password='Kids' where ProfileID=2

works within Access. But neither of the above statements work when
using them from VB. I get a "Syntax Error in Update command."

Also, Insert statements into the same database, same program work
fine.

Can you please show us the VB.Net code? If you don't use the OleDBCommand's
Parameters property (cmd.Parameters), use it.


Armin
 
S

sloan

Try

Current=1

or


Armin Zingler said:
Can you please show us the VB.Net code? If you don't use the
OleDBCommand's Parameters property (cmd.Parameters), use it.


Armin
 
A

Anil Gupte

OK, never mind I figured it out.

Update Profiles set Profiles.ProfileName='Kids', Profiles.Current=True,
etc...

i.e. I had to use TableName.Field instead of just Field.

Go figure - never seen that before.

Thanx anyway,
 
P

Phil

OK, never mind I figured it out.
Update Profiles set Profiles.ProfileName='Kids', Profiles.Current=True,
etc...

i.e. I had to use TableName.Field instead of just Field.

Go figure - never seen that before.

I think I've seen something like this a while ago. It seemed to be the name
of one particular field that it didn't like. I assume it must have been a
reserved word in OleDB but not in Access itself, or something like that. Try
renaming the 'Current' field to something else, and see if that helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top