Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread sql not working
Tue, Jul 11 2006 5:42 AMPermanent Link

Paul Waegemans
sql.add('UPDATE selectietest a SET a.lic=true,a.licentie=b.licentie FROM selectietest a ');
Sql.add('JOIN licenties b ON (a.lid_ID=b.lid_ID) ');
sql.add('WHERE b.seizoen_ID=12 ');

works correct but if i change the code using a parameter

sql.add('UPDATE selectietest a SET a.lic=true,a.licentie=b.licentie FROM selectietest a ');
Sql.add('JOIN licenties b ON (a.lid_ID=b.lid_ID) ');
with params.CreateParam(ftinteger, 'Seizoentest', ptInput) do
      Asinteger:=Dmref.TblSeizoenSeizoen_ID.value;
sql.add('WHERE b.seizoen_ID=:seizoentest');

DOES NOT WORK...

What could be the problem.

DBISAM VER 3.30

Paul.
Tue, Jul 11 2006 10:16 AMPermanent Link

Chris Erdal
Paul Waegemans <paul.waegemans@imseuro.be> wrote in
news:3D81DDBB-176E-4984-99D0-0B64F761E4B5@news.elevatesoft.com:

> DOES NOT WORK...
>
> What could be the problem.
>

What IS the problem, exactly?

--
Chris
Tue, Jul 11 2006 11:14 AMPermanent Link

Paul Waegemans
The update does not work when using the parameter


Chris Erdal <chris@No-Spam-erdal.net> wrote:

Paul Waegemans <paul.waegemans@imseuro.be> wrote in
news:3D81DDBB-176E-4984-99D0-0B64F761E4B5@news.elevatesoft.com:

> DOES NOT WORK...
>
> What could be the problem.
>

What IS the problem, exactly?

--
Chris
Tue, Jul 11 2006 11:37 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Paul


try

sql.add('UPDATE selectietest a SET a.lic=true,a.licentie=b.licentie FROM selectietest a ');
Sql.add('JOIN licenties b ON (a.lid_ID=b.lid_ID) ');
sql.add('WHERE b.seizoen_ID=:seizoentest');

sql.parambyname('seizoentest').Asinteger := Dmref.TblSeizoenSeizoen_ID.value;



Roy Lambert
Tue, Jul 11 2006 11:55 AMPermanent Link

Paul Waegemans
That seems not to be the solution.

In my example the update works correctly with the vaue 12.  But I want the value to be the value of Dmref.TblSeizoenSeizoen_ID.value so I want
to use a parameter. BUT IT DOES NOT UPDATE correctly.  Maybe it does not update at all but that i cannot see.

Paul.    


Roy Lambert <roy.lambert@skynet.co.uk> wrote:

Paul


try

sql.add('UPDATE selectietest a SET a.lic=true,a.licentie=b.licentie FROM selectietest a ');
Sql.add('JOIN licenties b ON (a.lid_ID=b.lid_ID) ');
sql.add('WHERE b.seizoen_ID=:seizoentest');

sql.parambyname('seizoentest').Asinteger := Dmref.TblSeizoenSeizoen_ID.value;



Roy Lambert
Tue, Jul 11 2006 1:47 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Paul


with DBISAMQuery1 do begin
sql.Add('select * from eln');
sql.add('where _fkcompanies = :fred');
parambyname('fred').asinteger := DBISAMTable1.fieldbyname('_id').asinteger;
execsql;
end;

Works here (ok its V4 but that shouldn't make any difference)


Roy Lambert
Tue, Jul 11 2006 2:11 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Paul,

<< works correct but if i change the code using a parameter

sql.add('UPDATE selectietest a SET a.lic=true,a.licentie=b.licentie FROM
selectietest a ');
Sql.add('JOIN licenties b ON (a.lid_ID=b.lid_ID) ');
with params.CreateParam(ftinteger, 'Seizoentest', ptInput) do
      Asinteger:=Dmref.TblSeizoenSeizoen_ID.value;
sql.add('WHERE b.seizoen_ID=:seizoentest');

DOES NOT WORK...

What could be the problem. >>

Did you try letting the query do the parameter population
(TDBISAMQuery.ParamCheck=True) and just setting the parameter after:

sql.add('UPDATE selectietest a SET a.lic=true,a.licentie=b.licentie FROM
selectietest a ');
Sql.add('JOIN licenties b ON (a.lid_ID=b.lid_ID) ');
sql.add('WHERE b.seizoen_ID=:seizoentest');
ParamByName('Seizoentest').Asinteger:=Dmref.TblSeizoenSeizoen_ID.value;
ExecSQL;

--
Tim Young
Elevate Software
www.elevatesoft.com





Image