hi
im trying to retrieve data from a foxpro database in a date range selected by the user from 2 datetimepicker boxes

dim date1, date2 as date

date1=datetimepicker1.value.date
date2=datetimepicker2.value.date
i used this command
oSql="select * from customer where between(customer.date,{^date1},{^date2})"
an empty table comes up.....can any one help pleas

hi
im trying to retrieve data from a foxpro database in a date range selected by the user from 2 datetimepicker boxes

dim date1, date2 as date

date1=datetimepicker1.value.date
date2=datetimepicker2.value.date
i used this command
oSql="select * from customer where between(customer.date,{^date1},{^date2})"
an empty table comes up.....can any one help pleas

Hi
There are a few things I'd suggest to try and troubleshoot this:

Looking at your code, you have put your select statement into a string but where you mean to pass in the date values you have just put the text date1 and date2 i.e. instead of:

oSql="select * from customer where between(customer.date,{^date1},{^date2})"

You should have:

oSql="select * from customer where between(customer.date,{^" & date1 & "},{^" & date2 & "})"

If this is does not work then try:

oSql="select * from customer "

to ensure you have connected to the database and have records in the table.
The actual syntax of your SQL looks off to me but I have never used FoxPro so I can't really comment. Although, I would use (for SQL Server):

oSql="select * from customer WHERE (customer.date > '" &date1 &"') AND ( customer.date <'" &date2 &"')"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.