在MySQL中检索数据,并在日历控件VB.Net中显示它 [英] Retrieve data in MySQL and display it in calendar control VB.Net

查看:1529
本文介绍了在MySQL中检索数据,并在日历控件VB.Net中显示它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是在VB.Net中创建一个计划系统,我使用日历控制,在我提出我的问题之前,让我先解释一下我想要发生的情况。



我在VB.Net中有一个表单,它看起来像这样。



这里是我的数据库





和上表的字段。

  RefID 
PersonName
DateSchedule(DateField)

现在这里是我的问题。如何在我的日历控制中显示这些数据?像这样(示例)





如何实现这种输出?无论我输入多少数据,都会按照日期对数据进行分组,并将其显示在日历中。



假设我将在6月6日输入数据,显示6月4日和6日的数据。

解决方案

希望您不需要对数据进行分组。应用where子句并获取所有数据,并根据结果将数据加载到日历控件中

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

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

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


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.

解决方案

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

这篇关于在MySQL中检索数据,并在日历控件VB.Net中显示它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆