Visual Studio 2010如何在数据集查询向导中查询当前月份以从Access.mdb数据库中检索记录 [英] Visual Studio 2010 how to query the current month in a dataset query wizard to retrieve records from an Access.mdb database

查看:385
本文介绍了Visual Studio 2010如何在数据集查询向导中查询当前月份以从Access.mdb数据库中检索记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<下面的查询似乎不会影响查询,仍显示数据库中的所有数据,但它不会过滤查询设计器中的结果。我需要这个查询来加载datagridview(at load)和当前的Month记录。我将(ThisDate)列设置为短日期dd / MM / yyyy。请有人帮助新手,我没有留下太多的头发,因为我正在将它翻出来处理这个简单的查询。 HEEEELP我正在努力!!!!



SELECT tblarp.ID,ThisDate,TimeStart,TimeFinish,TotalTime,StartTempo,FinishTempo,[BPM +/-],Notes

FROM tblarp

WHERE(((年([ThisDate]))=年(Now()))AND((月([ThisDate]))=月(现在())));

<The query below appears to not affect the query and still shows all of the data from the DB, but it does not filter the results in the query designer. I need this query to load the datagridview (at from load) with the current Month records. I have the (ThisDate) column set to short date dd/MM/yyyy. Can someone help a novice please, I don’t have much hair left as I’m ripping it out to work this simple query out. HEEEELP i'm struggling!!!!

SELECT tblarp.ID, ThisDate, TimeStart, TimeFinish, TotalTime, StartTempo, FinishTempo, [BPM+/-], Notes
FROM tblarp
WHERE (((Year([ThisDate]))=Year(Now())) AND ((Month([ThisDate]))=Month(Now())));

推荐答案

根据在Access查询中使用日期作为条件的示例 [ ^ ]

它应该是

According to Examples of using dates as criteria in Access queries[^]
It should be
Date()



for今天的日期。而不是


for today's date. instead of

Now()


这篇关于Visual Studio 2010如何在数据集查询向导中查询当前月份以从Access.mdb数据库中检索记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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