Mayank Jani

Mayank Jani

  • NA
  • 477
  • 77.5k

Select query when date range given by TextBoxes...

Sep 5 2018 12:40 PM
Hiii
There is a Windows Form with a DataGridView, two TextBoxes and a Button.
date range is given in the TextBoxes as from and to dates.
 
my problem is when I give date range of the same month, e.g. 05/08/2018 to 20/08/2018, it gives correct records within the date range but, when I give date range within two or more months, e.g. 15/08/2018 to 11/09/2018, it gives all the records regardless the date range given!!! I do not understand what is the problem.
Here is my query...
 
Select BillSrNo, BillNumber, BillCustName, BillAmtPaid From Billings Where BillDate Between'" + txtFromDt.Text + "' AND '" + txtToDt.Text + "' Order By BillSrNo
 
Please note that I use MS Access and the DataType is Text. Previously I have tried the same with DateTimePicker and DataType as Date/Time but it gives error. I want to use TextBox, is it possible?
Why it is not giving correct data when date range is between two or more months ?
 
Thanks
 
Mayank Jani

Answers (13)