I am trying to run an update query on an access database from FoxPro,
and I keep getting the error:

Too few parameters. Expected 1.

I can connect to the table and run a select with no problem. The query
I am running is:

retval=SQLEXEC(ODBChandle,"update [addresses - MASTER LIST] set
zip='&tmpVal' where idnumber=2879")

I have tried just about every combination of brackets and quotes that I
can think of. I have also tried hard coding a value instead of using a
macro. Nothing works.

Kevin Clark
Seton Home Study School

Re: Update query on an access database by KevClark64

KevClark64
Thu Oct 26 13:49:21 CDT 2006

Never mind, I figured it out. Turned out I was trying to update a
field label name, rather than a field. IdNumber should have been ID.

Kevin Clark


Re: Update query on an access database by Bernhard

Bernhard
Thu Oct 26 14:00:49 CDT 2006

Hi Kevin,

> I can connect to the table and run a select with no problem. The query
> I am running is:
>
> retval=SQLEXEC(ODBChandle,"update [addresses - MASTER LIST] set
> zip='&tmpVal' where idnumber=2879")
>
> I have tried just about every combination of brackets and quotes that I
> can think of. I have also tried hard coding a value instead of using a
> macro. Nothing works.
You already found the bug.
But instead of macro, hard coding etc. use ODBC parameters: include a foxpro
variable (or even a complex foxpro expression) preceded by a question mark.

retval=SQLEXEC(ODBChandle,"update [addresses - MASTER LIST] set zip=?tmpVal
where idnumber=2879")

Regards
Bernhard Sander