Board index » off-topic » Exception ("To few parameters") with my ADOCommand

Exception ("To few parameters") with my ADOCommand


2003-10-29 08:54:55 PM
off-topic6
I'm new to ADO routines and I'm encountering a problem with them.
I've set up a ADOConnection. I can read it OK using an ADODataSet. But
when I attempt to update the table using a ADOCommand I get a
EOleException with message '[Microsoft][ODBC Microsoft Access
Driver]To few parameters. Expect 1'
The code is:
with DM.ADOCommand1 do
begin
CommandType := cmdText;
CommandText := 'UPDATE tabCust SET Surname="Testing" WHERE
ID=19810';
Execute;
end;
It gives the exception when it strikes the Execute command.
Help!
Kevin P.
 
 

Re:Exception ("To few parameters") with my ADOCommand

I'm posting a follow-up to my own posting because I worked out the
solution.
I was simply that I should have been using single quotes instead on
double quotes in CommandText line.
In other words, it should have been
CommandText := 'UPDATE tabCust SET Surname''Testing'' WHERE
ID=19810';
that is two single quotes
and not
CommandText := 'UPDATE tabCust SET Surname="Testing" WHERE
ID=19810';