このコードは会計年度を自動的に更新します...
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
みんなの助けに感謝します。