如何在商店程序中将月份作为参数传递? [英] How to pass month year as parameter in store procedure?

查看:50
本文介绍了如何在商店程序中将月份作为参数传递?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我根据月份和年份显示每个学生的出勤详情。

我想显示每月出勤率(一个月或几个月)。

申请中,我有两个文本框,一个用于开始月份,另一个用于结束月份。

我想将这两个值作为参数传递。

我想要计算数量那个月的天数并存储在变量中,并将该变量显示为输出中的列。

另一个是计算当前天数和缺席天数,并在输出的单独列中显示这两个值。 div class =h2_lin>解决方案

下面是示例程序,它会帮助你





创建程序Usp_SelectStudentPresetDetails 
As
@FromDate Datetime,
@EndDate Datetime
Begin

选择StudentName,intime
来自TableName
其中 DATEDIFF(d,@ FromDate,FromDate)> = 0
AND DATEDIFF(d,@ EndDate,ToDate)< = 0
AND intime IS NOT NULL


end


I am displaying attendance details of each student on basis of month and year.
I want to display the monthly attendance (one or many months).
In application,i had two text boxes,one for starting month and another for ending month.
I want to pass this two values as parameters.
I want to caluclate the number of days in that month and store in variable,and to display that variable as column in output.
another is to calculate the present days and absent days, and display these two values in separate columns in output.

解决方案

Below are sample procedure it will help you


Create Procedure Usp_SelectStudentPresetDetails
As
@FromDate Datetime,
@EndDate Datetime
Begin

Select StudentName,intime
From TableName 
where DATEDIFF(d,@FromDate,FromDate) >= 0
			  AND DATEDIFF(d,@EndDate,ToDate)<= 0
			  AND intime IS NOT NULL


end


这篇关于如何在商店程序中将月份作为参数传递?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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