[Lazarus] Problem working with Params in TSQLQuery
Rodney Pont
mlist4 at infohitsystems.ltd.uk
Mon Aug 18 11:02:12 CEST 2008
On Mon, 18 Aug 2008 02:01:14 -0300, Eduardo Lopez wrote:
>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 first one has quotes around the data string you are comparing
against, has the second one got the quotes too when it's passed to the
database?
--
Regards - Rodney Pont
E-mail by PMMail - mlist4 at infohitsystems.ltd.uk
really weird out of context words courtesy of PMMail's spellchecker
More information about the Lazarus
mailing list