PDA

View Full Version : [SOLVED] Filter DataBase Between Selected Start and End Dates w/ Visual Studio 2012



Rlb53
09-28-2013, 02:51 PM
I entered the following into a Visual Studio Form to Filter the DataBase for entries between a Starting Date and Ending Date.
The Filter Returns Entries that are Less Than and Equal to the Ending Date (<= DateTimePicker2),
The Filter Returns Entries that are Greater Than the Start Date (>= DateTimePicker1), However,
It DOES NOT Return the Entries that are Equal to the Start Date.

MyDataBaseBindingSource.Filter = "Customer= '" & Customer.Text & _
"' and product= '" & Product.Text & _
"' and saledate >='" & DateTimePicker1.Value & _
"' and saledate <= '" & DateTimePicker2.Value & "'"



If I am not in the proper forum, I apologize. Please direct me accordingly.
Thank you for your assistance.

Rlb53
10-07-2013, 07:03 PM
I entered the following into a Visual Studio Form to Filter the DataBase for entries between a Starting Date and Ending Date.
The Filter Returns Entries that are Less Than and Equal to the Ending Date (<= DateTimePicker2),
The Filter Returns Entries that are Greater Than the Start Date (>= DateTimePicker1), However,
It DOES NOT Return the Entries that are Equal to the Start Date.

MyDataBaseBindingSource.Filter = "Customer= '" & Customer.Text & _
"' and product= '" & Product.Text & _
"' and saledate >='" & DateTimePicker1.Value & _
"' and saledate <= '" & DateTimePicker2.Value & "'"



If I am not in the proper forum, I apologize. Please direct me accordingly.
Thank you for your assistance.

I found a Solution:


MyDataBaseBindingSource.Filter= "Customer= '" & Customer.Text & _
"' and product= '" & Product.Text & _
"' and saledate >= '" & DateTimePicker1.Value.AddDays(-1) & _
" and saledate <= '" & DateTimePicker2.Value & "'"