如何在vb中获得星期几从月份数和年份开始的日期 [英] how to get sundays dates from month number and year in vb
本文介绍了如何在vb中获得星期几从月份数和年份开始的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在VB中特定月份的星期日
请帮助我
thx提前
i need a dates of sundays of particular month in VB
pls help me
thx in advance
推荐答案
这不是很难,但这听起来像是家庭作业,所以我会把代码留给你
1)创建一个DateTime对象:
It isn't exactly difficult, but this sounds like homework, so I'll leave the code to you
1) Create a DateTime object:
Dim firstOfMonth As New DateTime(year, month, 1)
2)找出使用DateTime.DayOfWeek属性的星期几。
3)如果不是星期天,使用DateTime.AddDays前往第一个星期天。
4)添加7天到日期用完...
2) Find out which day of the week that is using the DateTime.DayOfWeek Property.
3) If isn't not a sunday, use DateTime.AddDays to move forward to the first sunday.
4) Add 7 days to the date until you run out of month...
我写了这个proc
"I written this proc
CREATE procedure [dbo].[sp2_pay3]
@id varchar(max)
as begin
select isnull(sum(r_amount ),0) as 'paid' from [dbo].[sales_payment]
where [s_id] IN (@id)
end
当我传递参数时
when i pass parameters
sp2_pay3 '28,29'
我收到此错误
i am getting this error
Msg 245, Level 16, State 1, Procedure sp2_pay3, Line 4
Conversion failed when converting the varchar value '28,29' to data type int.
请告诉我解决方案ns
您不能这样做:IN子句在编译查询时在内部转换,而不是在参数准备就绪时。
请参阅此处:使用逗号分隔值SQL IN子句中的参数字符串 [ ^ ]
这篇关于如何在vb中获得星期几从月份数和年份开始的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文