如何在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子句中的参数字符串 [ ^ ]