[Gambas-user] Pb with database update.

Benoit Minisini gambas at ...1...
Tue Mar 30 20:15:39 CEST 2004


On Monday 29 March 2004 23:24, Jack wrote:
> Hello Gambers !
>
> When i update my base (please see the command below) i have this message.
> "Expression too complex. Too many operands à la ligne 507 dans
> Fclient.class" My table "Tab" have more than 30 fields. How to do for
> update my database ?
>
> Thank you very much for yours explanations.
>
> _~ Jack ~_
>
> My command :
> ...

It just means that the line you want to type is too complex for the 
interpreter. You cannot use the '&' operator with more than 32 operands.

You have three solutions :

1) Use braces to split your concatenation: DB.Exec((... & ... & ...) & (... 
& ... & ...))

2) Use an intermediate variable:

sExec = ... & ... & ...
sExec = sExec & ... & ... & ...
DB.Exec(sExec)

3) Use Recordsets in Edit mode. The UPDATE SQL command will be automatically 
contructed by Gambas.

DIM rEdit AS Recordset
DIM sWhere AS String

rEdit = DB.Edit("MyTable", sWhere)
rEdit!Field1 = Value1
rEdit!Field2 = Value2
...
rEdit.Update

I always prefer the third solution, because then your code is independent of 
the underlying database.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list