Ver Mensaje Individual
  #1  
Antiguo 20-12-2016
identsoft identsoft is offline
Miembro
 
Registrado: abr 2006
Posts: 282
Reputación: 18
identsoft Va por buen camino
sqlquery con parametros no me funciona

Este query
Código Delphi [-]
    SQLVarios.SQL.Clear;
    SQLVarios.SQL.Text := 'select count(*) as cuentas from CLIENTES ' +
                          ' where CLIENTE between :IDESDECLI and :IHASTACLI ' +
                          ' and AGENTE between :IDESDEAGEN and :IHASTAAGEN ';
    SQLVarios.ParamByName('IDESDECLI').AsInteger := StrToInt(edtDesdeCli.Text);
    SQLVarios.ParamByName('IHASTACLI').AsInteger := StrToInt(EdtHastaCli.Text);
    SQLVarios.ParamByName('IDESDEAGEN').AsInteger := StrToInt(EdtDesdeCor.Text);
    SQLVarios.ParamByName('IHASTAAGEN').AsInteger := StrToInt(edtHastaCor.Text);
    SQLVARIOS.Open;

Da resultado 0

La misma sin parametros
Código Delphi [-]
    SQLVarios.SQL.Clear;
    SQLVarios.SQL.Text := 'select count(*) as cuentas from CLIENTES ' +
                         ' where CLIENTE between ' + edtDesdecli.Text + '  and ' + edtHastaCli.Text  +
                          ' and AGENTE between ' + edtDesdeCor.Text + ' and ' + edtHastaCor.Text;
    SQLVARIOS.Open;
da resultado 1630.
Utilizo
DBExpress, BD es FireBird 2.5 entorno Delphi XE2.
¿porqué?.¿Alguien sabe que me falta, que estoy haciendo mal...?
Gracias
Responder Con Cita