Retrieve data in MySQL and display it in calendar

2019-09-02 21:20发布

问题:

I am targeting to create a Scheduling System in VB.Net and I am using Calendar Control, before I will ask my question, Let me explain to you first what scenario I would like to happen.

I have a form in VB.Net and it looks like this.

and here is my database

and fields of the table above are.

RefID
PersonName
DateSchedule (DateField)

Now here is my question. How can I display those data in my Calendar Control? like this (Example)

How can I achieve this kind of output? Regardless of how many data I will input it will Group the Data by Date and display it in the Calendar.

Lets say I will input data in Jun 6 so the calendar will Display Data from Jun 4 and 6.

回答1:

Hope you need not grouping the data. Apply where clause and fetch all the data and based on the result, you can load the data into the calendar control

SELECT @TestDate := '2016-06-06';

SELECT PersonName, DateSchedule
FROM TestingTable
WHERE DATE(DateSchedule) <= DATE(@TestDate)

SQL Fiddle: http://sqlfiddle.com/#!9/28fbd/7