此代码自动更新会计年度...
Dim yearVal As Double
If Date.Now.Month = 10 OrElse Date.Now.Month = 11 OrElse Date.Now.Month = 12 Then
yearVal = Date.Now.Year
Else
yearVal = Date.Now.Year - 1
End If
每年当这个变化到下一年时,我想自动执行这个sql存储过程......
ALTER PROCEDURE dbo.NewBudget
@year int,
@int nvarchar(3)
AS
BEGIN
SET NOCOUNT ON;
INSERT [NAOLI].[dbo].[BudgetReal]
([F_Year],[O_OrgCode],[O_OrgDesc],[S_SubObject],[S_SubDescrip],[B_BudgetAmt],[B_Initials],[B_CIPrefNo],[B_OrgBudgetAmt])
SELECT @year as [F_Year],[O_OrgCode],[O_OrgDesc],[S_SubObject],[S_SubDescrip], 0.00 as [B_BudgetAmt],@int as [B_Initials],[B_CIPrefNo],[B_OrgBudgetAmt]
FROM [NAOLI].[dbo].[BudgetReal]
END
去
我怎样才能做到这一点?
这成功了
Dim yearVal As Double
If Date.Now.Month = 10 OrElse Date.Now.Month = 11 OrElse Date.Now.Month = 12 Then
yearVal = Date.Now.Year
If yearVal = Date.Now.Month = 10 OrElse Date.Now.Month = 11 OrElse Date.Now.Month = 12 Then
dt = dal.ExecuteSelectStoredProc(dal.dbType.SqlServer, "NewBudget", "@year", DropDownList1.Text, "@int", )
End If
Else
yearVal = Date.Now.Year - 1
End If
感谢大家的帮助。