Using the date from DateTimePicker in a windows form to select dates from a MySql table 1 month old in VB.NET

  • Thread starter Thread starter nigelsvision
  • Start date Start date
N

nigelsvision

Guest
Hi, I am playing with dates in a windows form. I have a DateTimePicker which shows the current day. I am filling a DataGrid with the returned values of a MySql database.

I can now get the returned values of dates I select in my DateTimePicker which is great. For instance the code below will select all dates in a MySql database that are higher or equal to the date I select by clicking on the DateTimePicker. @StartDate ref to DateTimePicker



Dim Query = "select id, UserName, Serial, TimeDate, Image1, Image2 FROM Users WHERE TimeDate >= @StartDate AND Company ='" + CompanyNameTxt.Text() + " '"

Im not sure how to select dates that are 30 days or 1 month earlier than the date showing on the DateTimePicker. Can someone please give me an example.


Regards

Continue reading...
 
Back
Top