Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > Tablas planas
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 20-09-2006
leodelca23 leodelca23 is offline
Miembro
 
Registrado: jul 2006
Posts: 91
Poder: 18
leodelca23 Va por buen camino
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;
Responder Con Cita
  #2  
Antiguo 20-09-2006
Avatar de vtdeleon
vtdeleon vtdeleon is offline
Miembro
 
Registrado: abr 2004
Ubicación: RD & USA
Posts: 3.236
Poder: 24
vtdeleon Va por buen camino
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
__________________
Van Troi De León
(Not) Guía, Code vB:=Delphi-SQL, ¿Cómo?
Viajar en el tiempo no es teóricamente posible, pues si lo fuera, ya estarían aqui contándonos al respecto!
Responder Con Cita
  #3  
Antiguo 20-09-2006
leodelca23 leodelca23 is offline
Miembro
 
Registrado: jul 2006
Posts: 91
Poder: 18
leodelca23 Va por buen camino
bueno gracias ahi pruebo y les cuentos. Pero porque debo quitar el quotedstr
Responder Con Cita
  #4  
Antiguo 20-09-2006
leodelca23 leodelca23 is offline
Miembro
 
Registrado: jul 2006
Posts: 91
Poder: 18
leodelca23 Va por buen camino
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;
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Error al filtrar una tabla judit25 Conexión con bases de datos 1 01-06-2006 16:04:23
Filtrar una tabla paradox lbidi Tablas planas 5 22-09-2004 18:24:07
Filtrar Tabla jovehe Tablas planas 6 15-09-2004 22:06:32
como filtrar una tabla andre navarrete Varios 5 11-08-2004 06:17:19
Filtrar una tabla Tangela Conexión con bases de datos 1 29-05-2003 00:56:37


La franja horaria es GMT +2. Ahora son las 10:39:56.


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
Copyright 1996-2007 Club Delphi