Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Tablas planas (https://www.clubdelphi.com/foros/forumdisplay.php?f=20)
-   -   error al filtrar tabla (https://www.clubdelphi.com/foros/showthread.php?t=35764)

leodelca23 20-09-2006 09:47:57

error al filtrar tabla
 
Hola a todos tengo problemas con el filtrado, Me da error y no se como evitarlo obviemos la parte de la fecha que la pregunte en otro hilo pero no se si hice bien talvez la complique un poco, pero fue la unica forma que se me ocurrio si saben otra me dicen. Gracias saludos. El error es cdo chequeo algun componente y doy click en boton filtrar.
Código:

procedure TFTodos.BFiltrarClick(Sender: TObject);
var
fecha:TDateTimeField;
temp:string;
begin
IBQInformes.Close;
temp:='';
IBQInformes.Sql.Clear;
  if Cbvencidos.Checked=true then
    begin
    fecha.Value:=today;
    temp:='Telas.FECHA_PROMETIDA > 20/09/2006';
    end;
  if Cbfaltantes.Checked=true then
    if temp='' then
      temp:='Telas.Cantidades_Faltantes > 0'
    else
      temp:=temp+' and Telas.Cantidades_Faltantes > 0';
  If CBcliente.checked=true then
    begin
    if temp='' then
      temp:='Telas.Cliente ='+ECLiente.text
    else
    temp:=temp+' and Telas.Cliente ='+ECLiente.text;
    ECLiente.Clear;
    end;
  if cbpo.Checked=true then
    begin
    if temp='' then
      temp:='Telas.PO ='+Epo.text
    else
      temp:=temp+' and Telas.PO ='+Epo.text;
      EPO.Clear;
    end;
  if cbdetalle.Checked =true then
    begin
    if temp='' then
      temp:='Telas.descripcion1 ='+Edit1.text
    else
      temp:=temp+' and Telas.descripcion1 ='+Edit1.text;
    Edit1.Clear;
    end;   
 if temp='' then
      IBQInformes.SQL.Add('SELECT * FROM Telas INNER JOIN Descripcion '+
    'ON Telas.Descripcion1 = Descripcion.Descripcion')
 else
  IBQInformes.SQL.Add('SELECT * FROM Telas INNER JOIN Descripcion '+
    'ON Telas.Descripcion1 = Descripcion.Descripcion where '+QuotedStr(temp)+')');
  IBQInformes.Open;
end;


vtdeleon 20-09-2006 13:55:38

Saludos

Quita al final el QuotedStr
Código Delphi [-]
...
 else
   IBQInformes.SQL.Add('SELECT * FROM Telas INNER JOIN Descripcion '+
    'ON Telas.Descripcion1 = Descripcion.Descripcion where '+temp);

Saludos

leodelca23 20-09-2006 16:21:18

bueno gracias ahi pruebo y les cuentos. Pero porque debo quitar el quotedstr

leodelca23 20-09-2006 17:23:07

seguian los errores
 
Funciono asi, probando lo hice andar pero realmente no fue algo que sabia, pero si alguien me lo puede explicar gracias

Cita:

procedure TFTodos.BFiltrarClick(Sender: TObject);
var
fecha:TDateTimeField;
temp:string;
begin
IBQInformes.Close;
temp:='';
IBQInformes.Sql.Clear;
if Cbvencidos.Checked=true then
begin
fecha.Value:=today;
temp:='Telas.FECHA_PROMETIDA > 20/09/2006';
end;
if Cbfaltantes.Checked=true then
if temp='' then
temp:='Telas.Cantidades_Faltantes > 0'
else
temp:=temp+' and Telas.Cantidades_Faltantes > 0';
If CBcliente.checked=true then
begin
if temp='' then
temp:='Telas.Cliente ='+Quotedstr(ECLiente.text)
else
temp:=temp+' and Telas.Cliente ='+Quotedstr(ECLiente.text);
ECLiente.Clear;
end;
if cbpo.Checked=true then
begin
if temp='' then
temp:='Telas.PO ='+Quotedstr(Epo.text)
else
temp:=temp+' and Telas.PO ='+Quotedstr(Epo.text);
EPO.Clear;
end;
if cbdetalle.Checked =true then
begin
if temp='' then
temp:='Telas.descripcion1 ='+Quotedstr(Edit1.text)
else
temp:=temp+' and Telas.descripcion1 ='+Quotedstr(Edit1.text);
Edit1.Clear;
end;
if temp='' then
IBQInformes.SQL.Add('SELECT * FROM Telas INNER JOIN Descripcion '+
'ON Telas.Descripcion1 = Descripcion.Descripcion')
else
IBQInformes.SQL.Add('SELECT * FROM Telas INNER JOIN Descripcion '+
'ON Telas.Descripcion1 = Descripcion.Descripcion where '+temp);
IBQInformes.Open;
end;


La franja horaria es GMT +2. Ahora son las 17:39:01.

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