Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   SQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=6)
-   -   Consulta numerica (https://www.clubdelphi.com/foros/showthread.php?t=23992)

alcides 04-08-2005 16:06:38

Consulta numerica
 
hola a todos,

esta consulta es alfabetica, lo que quisiera es hacer esta misma consulta pero numerica.
que en lugar de Descripcion_Expediente sea Numero_Expediente
pero el mismo tipo de busqueda.

Código PHP:

procedure TFrm_Consulta_Exp.DescripcionChange(SenderTObject);
const
 
STRSQL 'select * from Maestro_Expediente';
 
STRORDER ' ORDER BY Descripcion_Expediente';
begin
   Qry_busca_Expediente
.Close;
   if (
Descripcion.Text ''then begin
     Qry_busca_Expediente
.SQL.Text := STRSQL;
   
end
   
else begin
     Qry_busca_Expediente
.SQL.Text := STRSQL +
        
' WHERE Descripcion_Expediente LIKE ' QuotedStr('%' Descripcion.Text '%') +
        
STRORDER;
   
end;
   
qry_busca_Expediente.Open;
end


Gracias mil,

Alcides
Rep.Dom.

Neftali [Germán.Estévez] 04-08-2005 16:14:09

NOTA: Si colocas código delphi puedes utilizar los TAG´s de Delphi (Delphi y /Delphi entre corchetes).

Código Delphi [-]
 
 // Suponiendo que el control se llama numero
 procedure TFrm_Consulta_Exp.NumeroChange(Sender: TObject); 
 const 
  STRSQL = 'select * from Maestro_Expediente'; 
  STRORDER = ' ORDER BY Numero_Expediente'; 
 begin 
    Qry_busca_Expediente.Close; 
    if (Numero.Text = '') then begin 
      Qry_busca_Expediente.SQL.Text := STRSQL; 
    end 
    else begin 
      Qry_busca_Expediente.SQL.Text := STRSQL + 
         ' WHERE Numero_Expediente = ' + StrToInt(Numero.Text) + 
         STRORDER; 
    end; 
    qry_busca_Expediente.Open; 
 end;

alcides 04-08-2005 16:35:15

gracias mil neftali por tu ayuda,

ahora en la compilación me da el siguiente error:

Incompatible types: 'String' and 'Integer'

en esta linea es que me da el error

Código PHP:

    Qry_buscar_codigo.SQL.Text := STRSQL +
         
' WHERE Numero_Transacion = ' StrToInt(Codigo_buscar.Text) +
         
STRORDER

Gracias mil

ALcides
Rep.Dom.

Neftali [Germán.Estévez] 04-08-2005 16:45:44

Perdón...
Prueba con ésto:

Código Delphi [-]
 Qry_buscar_codigo.SQL.Text := STRSQL + 
 ' WHERE Numero_Transacion = ' + Codigo_buscar.Text + 
 STRORDER;

Sin el StrToInt.

alcides 05-08-2005 15:50:20

Gracias mil Neftali, por tu ayuda




Alcides
Rep.Dom.


La franja horaria es GMT +2. Ahora son las 21:54:52.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi