<% @ Language=VBScript %> <% Response.Buffer = True %> <% Dim message If ValidMembers() Then EditMembers() Set dbNVS = Nothing Response.Clear Response.Redirect "member_edit.asp?init=0&confirm=yes&comid=" + Cstr(Request.Form("hdCOM_ID")) Response.End Else message = "System error trying to submit member edit form.
Please click the BACK button." Response.Clear Response.Redirect "error.asp?mess=" + Server.URLEncode(message) Response.End End If %> <% '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Function ValidMembers() ValidMembers = False Dim intLoop 'validate all of the text boxes on the screen.... For intLoop = 1 to Clng(Request.Form("hdCOUNT")) If Trim(Request.Form("txtTERM" & Cstr(intLoop))) = "" Then message = "You must enter a TERM EXPIRATION for member #" + CStr(intLoop) + "." Response.Clear Response.Redirect "error.asp?mess=" + Server.URLEncode(message) Response.End End If If Clng(Len(Trim(Request.Form("txtTERM" & Cstr(intLoop))))) <> 4 Then message = "TERM EXPIRATION for member #" + CStr(intLoop) + " must be exactly 4 characters long." Response.Clear Response.Redirect "error.asp?mess=" + Server.URLEncode(message) Response.End End If If Not IsNumeric(Trim(Request.Form("txtTERM" & Cstr(intLoop)))) Then message = "TERM EXPIRATION for member #" + CStr(intLoop) + " must be numeric." Response.Clear Response.Redirect "error.asp?mess=" + Server.URLEncode(message) Response.End End If If CDate(Trim(Request.Form("txtTERM" & Cstr(intLoop)))) < Year(Date) Then message = "TERM EXPIRATION for member #" + CStr(intLoop) + " must be equal to or greater than the current year." Response.Clear Response.Redirect "error.asp?mess=" + Server.URLEncode(message) Response.End End If Next ValidMembers = True End Function '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %> <% '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Function EditMembers()%> <% On Error Resume Next EditMembers = False Dim strSQL Dim intLoop Dim cmdEDIT Set cmdEDIT = Server.CreateObject("ADODB.command") dbNVS.Open cmdEDIT.ActiveConnection = dbNVS dbNVS.BeginTrans For intLoop = 1 to Clng(Request.Form("hdCOUNT")) strSQL = "UPDATE [MEMBER] SET" strSQL = strSQL + " [TYPE_ID]=" + Cstr(Request.Form("selType" & Cstr(intLoop))) + "," strSQL = strSQL + " [TERM]= '" + Cstr(Request.Form("txtTERM" & Cstr(intLoop))) + "'" strSQL = strSQL + " WHERE [USER_ID]=" + Cstr(Request.Form("hdUSER_ID" & Cstr(intLoop))) strSQL = strSQL + " AND [COMID]=" + Cstr(Request.Form("hdCOM_ID")) cmdEDIT.CommandText = strSQL cmdEDIT.Execute 'Error Handling in a small way... If Err.Number > 0 then 'something is wrong...don't allow update to database... dbNVS.RollBack message = "A system error occured with the function EditMembers." + _ "
Please click the BACK button." Response.Clear Response.Redirect "error.asp?mess=" + Server.URLEncode(message) Response.End EditMembers = False End if Next dbNVS.CommitTrans dbNVS.Close Set cmdEDIT = Nothing EditMembers = True End Function '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %> <% Response.End %>