Jump to content

[RESOLVIDO] Query entre 2 datas


pmaster
 Share

Recommended Posts

Boa tarde a todos

Pessoal é o seguinte, eu tenho 2 timepikers e uso-os como referencia, para fazer uma query que é a seguinte:

sql = "Select * from movi where  dataop >= # " & DateTimePicker1.Text & " # and dataop <= # " & DateTimePicker2.Text & " #  ORDER BY dataop ASC;"

Mas esta query nao me retorna nada, e já me sentifiquei que tenho dados na base de dados.

Alguem me pode ajudar?

Obrigado 😉

Link to comment
Share on other sites

Tenta formatar a Data para o formato internacional "YYYY-MM-DD", ou para o sistema Americano "MM-DD-YYYY".

Acontece que na data "30-12-2009"  o mês 30 não existe e o sistema busca um formato possivel, neste caso o "DD-MM-YYYY".

O caminho mais curto para conseguir fazer muitas coisas é fazer uma de cada vez. Samuel Smiles

Link to comment
Share on other sites

Já tive o cuidado de ver como fica em debug, testei agora de novo e fica da seguinte maneira:

dataop <= # 03-12-2009 # and dataop >= # 06-12-2009 #

Desde já obrigado 😉

Que data é que é menor ou igual a 3-12-2009 e ao mesmo tempo maior ou igual a 6-12-2009 ?

Eu nao conheco nenhuma, se nao esta a retornar nada quer dizer que esta a fazer bem  😞

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.