Fórum Data #196310
20/11/2003
0
1° Botão: Consultar datas menores que a do maskedit2
query1.close;
query1.sql.clear;
query1.sql.add (´select * from data where data <´+quotedstr(maskedit2.text)+´order by data´);
query1.open;
2° Botão: Consultar datas maiores que a do maskedit2
query1.close;
query1.sql.clear;
query1.sql.add (´select * from data where data >´+quotedstr(maskedit2.text)+´order by data´);
query1.open;
Quando a data é por exemplo:28/11/1970 e tenho ela gravada na tabela e aperto o 1º botão, para consultar datas menores que esta, recebo a msg:
TYPE MISMATCH IN EXPRESSION
Qual o meu erro ?
Alguém poderia me dar uma ajuda ??
E sem querer abusar, como seria com o componente table ??
Valeu galera, um abraço a todos !!
Seneca
Curtir tópico
+ 0Posts
21/11/2003
Rafael_gamba
query1.sql.add (´select * from data where data <´+quotedstr(maskedit2.text)+´order by data´);
Você está comparando uma data com uma string.
Compare data com data ex:
query1.sql.add (´select * from data where data <´+StrToDate(maskedit2.text)+´order by data´);
faça isso nas duas instruções!!
Um abraço!!!
Gostei + 0
21/11/2003
Namerda
query1.sql.add (´select * from data where data < ´´+quotedstr(maskedit2.text)+´´ order by data´);
AJUDOU ???
OBS... ACHO Q A DICA DO COLEGA ACIMA NAUM FUNCIONA...
Gostei + 0
21/11/2003
Denis200
tabela.filter:=´data <´+#39+maskedit2.text+39;
tente desta forma comigo funcionou.
Gostei + 0
21/11/2003
Seneca
Valeu.
Gostei + 0
21/11/2003
Vanius
Acho q fica mais apresentavel.
query1.sql.add (´select * from data where data < :Data order by data´);
query1.ParamByName(´Data´).Value := StrToDateTime(maskedit2.text);
[]s,
Vanius
vaniusg@terra.com.br
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)