[Lazarus] Problem working with Params in TSQLQuery
Joost van der Sluis
joost at cnoc.nl
Mon Aug 18 10:30:39 CEST 2008
Op maandag 18-08-2008 om 09:14 uur [tijdzone +0200], schreef Michael Van
Canneyt:
>
> On Mon, 18 Aug 2008, Eduardo Lopez wrote:
>
> > The scenario:
> >
> > Lazarus 0.9.25 svn: 16095M
> > fpc 2.2.2
> > Ubuntu 8.04 GTK2
> > SQLDb components
> > TIBConnection
> >
> > The following query works well:
> >
> > qry02.SQL.Clear;
> > qry02.SQL.Text:= 'select PASSWOR from USUARIOS where CODUSU = ' +
> > chr(39) + trim(pUsuario) + chr(39);
> > trn02.Active:=true;
> > qry02.Open;
> > ContrasenaDB:=qry02.FieldByName('PASSWOR').AsString; // <--
> > ContrasenaDB get the value from the query
> >
> >
> > But this one don't get the value of 'PASSWOR':
> >
> > qry02.SQL.Clear;
> > qry02.SQL.Text:= 'select PASSWOR from USUARIOS where CODUSU = :pCODUSU';
> > qry02.Params.ParamByName('pCODUSU').AsString:= trim(pUsuario);
> > trn02.Active:=true;
> > qry02.Open;
> > ContrasenaDB:=qry02.FieldByName('PASSWOR').AsString; // <---
> > ContrasenaDB is empty
> >
> > (The second code was working with fpc 2.2.0 and the UIB components, with
> > some changes. When upgrade to fpc 2.2.2 i began to replace de UIB with
> > the default SQLDb componentes).
>
> I have parameters working. Is the ParseSQL property set to 'True' ?
That shoudn't make any difference. What if you use
params[0].asstring := ... ?
Joost
More information about the Lazarus
mailing list