<%@ LANGUAGE="VBScript" %> <% '------------------------------------------------------------------------------- ' Microsoft Visual InterDev - Data Form Wizard ' ' Action Page ' ' (c) 1997 Microsoft Corporation. All Rights Reserved. ' ' This file is an Active Server Page that contains the server script that ' handles filter, update, insert, and delete commands from the form view of a ' Data Form. It can also echo back confirmation of database operations and ' report errors. Some commands are passed through and redirected. Microsoft ' Internet Information Server 3.0 is required. ' '------------------------------------------------------------------------------- Dim strDFName Dim strErrorAdditionalInfo strDFName = "rsCorpAdminIEGroup" %> <% If Not IsEmpty(Request("DataAction")) Then strDataAction = Trim(Request("DataAction")) Else Response.Redirect "CorpAdminForm.asp?FormMode=Edit" End If '------------------ ' Action handler '------------------ Select Case strDataAction Case "List View" Response.Redirect "CorpAdminList.asp" Case "Cancel" Response.Redirect "CorpAdminForm.asp?FormMode=Edit" Case "Filter" On Error Resume Next Session("rsCorpAdminIEGroup_Filter") = "" Session("rsCorpAdminIEGroup_FilterDisplay") = "" Session("rsCorpAdminIEGroup_Recordset").Filter = "" Response.Redirect "CorpAdminForm.asp?FormMode=" & strDataAction Case "New" On Error Resume Next Session("rsCorpAdminIEGroup_Filter") = "" Session("rsCorpAdminIEGroup_FilterDisplay") = "" Session("rsCorpAdminIEGroup_Recordset").Filter = "" Response.Redirect "CorpAdminForm.asp?FormMode=" & strDataAction Case "Find" Session("rsCorpAdminIEGroup_PageSize") = 1 'So we don't do standard page conversion Session("rsCorpAdminIEGroup_AbsolutePage") = CLng(Request("Bookmark")) Response.Redirect "CorpAdminForm.asp" Case "All Records" On Error Resume Next Session("rsCorpAdminIEGroup_Filter") = "" Session("rsCorpAdminIEGroup_FilterDisplay") = "" Session("rsCorpAdminIEGroup_Recordset").Filter = "" Session("rsCorpAdminIEGroup_AbsolutePage") = 1 Response.Redirect "CorpAdminForm.asp" Case "Apply" On Error Resume Next ' Make sure we exit and re-process the form if session has timed out If IsEmpty(Session("rsCorpAdminIEGroup_Recordset")) Then Response.Redirect "CorpAdminForm.asp?FormMode=Edit" End If Set rsCorpAdminIEGroup = Session("rsCorpAdminIEGroup_Recordset") strWhere = "" strWhereDisplay = "" FilterField "GroupID", Null FilterField "GroupName", Null FilterField "INSFile", Null ' Filter the recordset If strWhere <> "" Then Session("rsCorpAdminIEGroup_Filter") = strWhere Session("rsCorpAdminIEGroup_FilterDisplay") = strWhereDisplay Session("rsCorpAdminIEGroup_AbsolutePage") = 1 Else Session("rsCorpAdminIEGroup_Filter") = "" Session("rsCorpAdminIEGroup_FilterDisplay") = "" End If ' Jump back to the form If Err.Number = 0 Then Response.Redirect "CorpAdminForm.asp" Case "Insert" On Error Resume Next ' Make sure we exit and re-process the form if session has timed out If IsEmpty(Session("rsCorpAdminIEGroup_Recordset")) Then Response.Redirect "CorpAdminForm.asp?FormMode=Edit" End If Set rsCorpAdminIEGroup = Session("rsCorpAdminIEGroup_Recordset") rsCorpAdminIEGroup.AddNew Do If Not InsertField("GroupID") Then Exit Do If Not InsertField("GroupName") Then Exit Do If Not InsertField("INSFile") Then Exit Do rsCorpAdminIEGroup.Update Exit Do Loop If Err.Number <> 0 Then If rsCorpAdminIEGroup.EditMode Then rsCorpAdminIEGroup.CancelUpdate Else If IsEmpty(Session("rsCorpAdminIEGroup_AbsolutePage")) Or Session("rsCorpAdminIEGroup_AbsolutePage") = 0 Then Session("rsCorpAdminIEGroup_AbsolutePage") = 1 End If ' Requery static cursor so inserted record is visible If rsCorpAdminIEGroup.CursorType = adOpenStatic Then rsCorpAdminIEGroup.Requery Session("rsCorpAdminIEGroup_Status") = "Record has been inserted" End If Case "Update" On Error Resume Next ' Make sure we exit and re-process the form if session has timed out If IsEmpty(Session("rsCorpAdminIEGroup_Recordset")) Then Response.Redirect "CorpAdminForm.asp?FormMode=Edit" End If Set rsCorpAdminIEGroup = Session("rsCorpAdminIEGroup_Recordset") If rsCorpAdminIEGroup.EOF and rsCorpAdminIEGroup.BOF Then Response.Redirect "CorpAdminForm.asp" Do If Not UpdateField("GroupID") Then Exit Do If Not UpdateField("GroupName") Then Exit Do If Not UpdateField("INSFile") Then Exit Do If rsCorpAdminIEGroup.EditMode Then rsCorpAdminIEGroup.Update Exit Do Loop If Err.Number <> 0 Then If rsCorpAdminIEGroup.EditMode Then rsCorpAdminIEGroup.CancelUpdate End If Case "Delete" On Error Resume Next ' Make sure we exit and re-process the form if session has timed out If IsEmpty(Session("rsCorpAdminIEGroup_Recordset")) Then Response.Redirect "CorpAdminForm.asp?FormMode=Edit" End If Set rsCorpAdminIEGroup = Session("rsCorpAdminIEGroup_Recordset") If rsCorpAdminIEGroup.EOF and rsCorpAdminIEGroup.BOF Then Response.Redirect "CorpAdminForm.asp" rsCorpAdminIEGroup.Delete ' Proceed if no error If Err.Number = 0 Then ' Requery static cursor so deleted record is removed If rsCorpAdminIEGroup.CursorType = adOpenStatic Then rsCorpAdminIEGroup.Requery ' Move off deleted rec rsCorpAdminIEGroup.MoveNext ' If at EOF then jump back one and adjust AbsolutePage If rsCorpAdminIEGroup.EOF Then rsCorpAdminIEGroup.MovePrevious Session("rsCorpAdminIEGroup_AbsolutePage") = Session("rsCorpAdminIEGroup_AbsolutePage") - 1 If rsCorpAdminIEGroup.BOF And rsCorpAdminIEGroup.EOF Then rsCorpAdminIEGroup.Requery End If End If End Select %> <% ' If Err Then %> <% ' Add additional error information to clarify specific errors Select Case Err.Number Case -2147467259 strErrorAdditionalInfo = " This may be caused by an attempt to update a non-primary table in a view." Case Else strErrorAdditionalInfo = "" End Select %> IEAK CorpAdmin Form
 Message: 
<% Select Case strDataAction Case "Insert" Response.Write("Unable to insert the record into IEGroup.") Case "Update" Response.Write("Unable to post the updated record to IEGroup.") Case "Delete" Response.Write("Unable to delete the record from IEGroup.") End Select %>
  Item Description
  Source: <%= Err.Source %>
  Error Number: <%= Err.Number %>
  Description: <%= Server.HTMLEncode(Err.Description & strErrorAdditionalInfo) %>

<% Response.Write "
" %>
To return to the form view with the previously entered information intact, use your browsers "back" button
<% Else %> IEAK CorpAdmin Form
 Feedback: 
   <% Select Case strDataAction Case "Insert" Response.Write("The following record has been inserted into CorpAdminIEGroup.") Case "Update" Response.Write("The following updated record has been posted to CorpAdminIEGroup.") Case "Delete" Response.Write("The following record has been deleted from CorpAdminIEGroup.") End Select %>
<% FeedbackField "GroupID", "GroupID", Null FeedbackField "GroupName", "GroupName", Null FeedbackField "INSFile", "INSFile", Null %>
  Field Value

<% Response.Write "
" %> <% If strDataAction = "Insert" Then %> <% Else %> <% End If %>
<% End If Set rsCorpAdminIEGroup = Nothing %>