最新黄网在线观看_丁香一区二区三区_国产精品视区_国内高清免费在线视频

提醒篇--增加學(xué)員生日提醒

2012年03月15日 05:53
點擊率:12833
首先我們先參考數(shù)據(jù)庫字典寫一條提醒,找到學(xué)員表Student里的生日字段Birthday,然后我們使用sql語法編寫查詢語句:
Select
StudentID as 學(xué)號,
StudentName as 姓名
from Student
where Birthday is not null
  and Datepart(month, Birthday) = Datepart(month, getdate())
  and Datepart(day, Birthday) = Datepart(day, getdate())

這個查詢是針對sql數(shù)據(jù)庫版的。

然后就可以增加提醒了,在系統(tǒng)-系統(tǒng)提醒-新建,按下圖所示把語法填寫好:
麥田培訓(xùn)學(xué)校管理軟件細節(jié)

完整的語法:
標    題:生日提醒
提示消息:今天有{0}名學(xué)員過生日了
數(shù)量查詢: 
Select
Count(*)
from Student
where Birthday is not null
  and DATEPART(month, Birthday) = DATEPART(month, getdate())
  and DATEPART(day, Birthday) = DATEPART(day, getdate()) 

展開查詢:
Select
StudentID as 學(xué)號,
StudentName as 姓名
from Student
where Birthday is not null
  and DATEPART(month, Birthday) = DATEPART(month, getdate())
  and DATEPART(day, Birthday) = DATEPART(day, getdate())

這里需要注意的是:
1.提示消息:今天有{0}名學(xué)員過生日了 ,括號里的是數(shù)字零。
2.數(shù)量查詢和展開查詢略有區(qū)別。

    這樣在系統(tǒng)首頁,我們就可以看到提醒了。
麥田培訓(xùn)學(xué)校管理軟件細節(jié)

上面講的是sql數(shù)據(jù)庫版的語法,Access數(shù)據(jù)庫版語法只需要改動兩個參數(shù)即可,如下圖:
麥田培訓(xùn)學(xué)校管理軟件細節(jié)

完整的語法:
標    題:生日提醒
提示消息:今天有{0}名學(xué)員過生日了
數(shù)量查詢: 
Select
Count(*)
from Student
where Birthday is not null
  and DATEPART('M', Birthday) = DATEPART('M', now())
  and DATEPART('d', Birthday) = DATEPART('d', now()) 

展開查詢:
Select
StudentID as 學(xué)號,
StudentName as 姓名
from Student
where Birthday is not null
  and DATEPART('M', Birthday) = DATEPART('M', now())
  and DATEPART('d', Birthday) = DATEPART('d', now())


主站蜘蛛池模板: 祁连县| 连江县| 禹州市| 措美县| 丹江口市| 内乡县| 绥滨县| 达日县| 泸溪县| 紫阳县| 遵义县| 额济纳旗| 全南县| 昆山市| 自贡市| 南部县| 遂昌县| 天祝| 兴山县| 宿迁市| 仁怀市| 潞西市| 赞皇县| 丹巴县| 望城县| 田林县| 岳普湖县| 商城县| 昌邑市| 怀化市| 桑日县| 来凤县| 延长县| 银川市| 饶平县| 诸暨市| 蕉岭县| 遂宁市| 威信县| 徐州市| 宣恩县|