<% ' main() Sub main() If Not(SessionCheck()) Then Exit Sub End If Dim Command Command = Request("Command") Dim DeleteGengo DeleteGengo = Request("DeleteGengo") Dim UpdateGengo UpdateGengo = Request("UpdateGengo") Dim TmpGengo Dim TmpKaishibi Dim Query Dim Content Dim TmpCnt If Command = "Add" Then TmpGengo = Request("Gengo0") TmpKaishibi = Request("Kaishibi0") If TmpGengo <> "" And TmpKaishibi <> "" Then TmpCnt = 0 Query = " " Query = Query & " " Query = Query & " SELECT MAX(元号CD) AS 最大元号CD " Query = Query & " FROM TC9元号M " Query = Query & " " Set Content = OpenQuery(Query) If Not(Content.BOF Or Content.EOF) Then If "" & Content.Fields("最大元号CD") <> "" Then TmpCnt = Content.Fields("最大元号CD") End If End If TmpCnt = TmpCnt + 1 Query = " " Query = Query & " " Query = Query & " INSERT INTO TC9元号M (システムCD, 元号CD, 元号, 開始日) " Query = Query & " VALUES ('" & GB_SystemCD & "', " & TmpCnt & ", '" & TmpGengo & "', '" & TmpKaishibi & "') " Query = Query & " " Set Content = OpenQuery(Query) End If ElseIf Command = "Delete" And DeleteGengo <> "" Then Query = " " Query = Query & " " Query = Query & " DELETE FROM TC9元号M " Query = Query & " WHERE 元号CD = " & DeleteGengo & " " Query = Query & " " Set Content = OpenQuery(Query) ElseIf Command = "Update" And UpdateGengo <> "" Then TmpGengo = Request("Gengo" & UpdateGengo) TmpKaishibi = Request("Kaishibi" & UpdateGengo) If TmpGengo <> "" And TmpKaishibi <> "" Then Query = " " Query = Query & " " Query = Query & " UPDATE TC9元号M " Query = Query & " SET 元号 = '" & TmpGengo & "' " Query = Query & " , 開始日 = '" & TmpKaishibi & "' " Query = Query & " WHERE 元号CD = " & UpdateGengo & " " Query = Query & " " Set Content = OpenQuery(Query) End If End If Response.Redirect("fm_gengo.asp") End Sub %>