使用复制可能性VB.NET将日期添加到数据库中 [英] Add dates into a database with recurrence possibility VB.NET

查看:96
本文介绍了使用复制可能性VB.NET将日期添加到数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力使用重复模式将日期插入数据库。

我能够添加StartDays和EndDates,我没有找到一个好方法来重复我的日子过了一段时间。

用户必须能够每天,每周,每月和每年重复该事件。

互联网上的所有教程都是针对ASP.NET / C#。我正在使用VB.NET和Access数据库。

提前谢谢。

I've been struggling with a recurrence mode for inserting my dates into a database.
I'm capable of adding StartDays and EndDates, I didn't find a good way of recurring my days over a period of time.
The user must be capable of repeating the event daily, weekly, monthly and yearly.
All the tutorials on the internet are either for ASP.NET/C#. I'm using VB.NET and an Access database.
Thanks in advance.

推荐答案

如果我理解你的话......



MS Access数据库不支持查询中的重复发生。您必须编写如下方法:

If i understand you well...

MS Access database does not supports recurrence in queries. You have to write method as below:
Dim startDate As Date = Date.Today()
Dim endDate As Date = startDate.AddDays(15)
Dim currDate As Date = startDate

Do While (currDate < endDate)
    Console.WriteLine("INSERT INTO TableName (StartDate, EndDate) VALUES ({0}, {1})", currDate, endDate)
    currDate = currDate.AddDays(1)
Loop





当你加入ñ看,我正在使用做......循环 [ ^ ]循环显示日期的语句。



As you can see, i'm using Do... Loop[^] statement to loop through the dates.


这篇关于使用复制可能性VB.NET将日期添加到数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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