<% ' ' Filename: typeextraction.asp ' Generated with CodeCharge 2.0.5 ' ASP 2.0.ccp build 01/22/2002 ' '------------------------------- ' typeextraction CustomIncludes begin %> <% ' typeextraction CustomIncludes end '------------------------------- '=============================== ' Save Page and File Name available into variables '------------------------------- sFileName = "typeextraction.asp" '=============================== '=============================== ' typeextraction PageSecurity begin CheckSecurity(1) ' typeextraction PageSecurity end '=============================== '=============================== ' typeextraction Open Event start ' typeextraction Open Event end '=============================== '=============================== ' typeextraction OpenAnyPage Event start ' typeextraction OpenAnyPage Event end '=============================== '=============================== ' Save the name of the form and type of action into the variables '------------------------------- sAction = GetParam("FormAction") sForm = GetParam("FormName") '=============================== ' typeextraction Show begin '=============================== ' Page execution '------------------------------- 'Initialize error variables '------------------------------- stypeextraction1Err = "" '------------------------------- ' Select the FormAction '------------------------------- Select Case sForm Case "typeextraction1" typeextraction1Action(sAction) end select '=============================== '=============================== ' HTML Page layout '------------------------------- %> EB Customers 1.09
<% MenuGeneral2_Show %>
<% MenuGeneral_Show %>
<% typeextraction_Show %>
<% typeextraction1_Show %>
<% ' typeextraction Show end ' typeextraction Close Event start ' typeextraction Close Event end '------------------------------- ' Destroy connection object '------------------------------- cn.close Set cn = nothing '=============================== '******************************************************************************** '=============================== ' Display Grid Form '------------------------------- Sub typeextraction_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "Extractions" Dim HasParam : HasParam = false Dim iSort : iSort = "" Dim iSorted : iSorted = "" Dim sDirection : sDirection = "" Dim form_sorting : form_sorting = "" Dim sSortParams : sSortParams = "" Dim form_action : form_action = "" Dim iRecordsPerPage : iRecordsPerPage = 200 Dim iCounter : iCounter = 0 Dim iPage : iPage = 0 Dim bEof : bEof = False Dim sActionFileName : sActionFileName = "typeextraction.asp" Dim transit_params : transit_params = "" Dim form_params : form_params = "" '------------------------------- ' Build ORDER BY statement '------------------------------- sOrder = " order by t.Name Asc" iSort = GetParam("Formtypeextraction_Sorting") iSorted = GetParam("Formtypeextraction_Sorted") sDirection = "" if IsEmpty(iSort) then form_sorting = "" else if iSort = iSorted then form_sorting = "" sDirection = " DESC" sSortParams = "Formtypeextraction_Sorting=" & iSort & "&Formtypeextraction_Sorted=" & iSort & "&" else form_sorting = iSort sDirection = " ASC" sSortParams = "Formtypeextraction_Sorting=" & iSort & "&Formtypeextraction_Sorted=" & "&" end if if iSort = 1 then sOrder = " order by t.Name" & sDirection if iSort = 2 then sOrder = " order by t.Description" & sDirection end if '------------------------------- ' HTML column headers '------------------------------- %> <% '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select t.Description as t_Description, " & _ "t.Name as t_Name, " & _ "t.id as t_id " & _ " from typeextraction t " '------------------------------- '------------------------------- ' typeextraction Open Event start ' typeextraction Open Event end '------------------------------- '------------------------------- ' Assemble full SQL statement '------------------------------- sSQL = sSQL & sWhere & sOrder '------------------------------- '------------------------------- ' Process the link to the record page '------------------------------- form_action = sActionFileName '------------------------------- '------------------------------- ' Open the recordset '------------------------------- openrs rs, sSQL '------------------------------- '------------------------------- ' Process empty recordset '------------------------------- if rs.eof then %> <% end if '------------------------------- '------------------------------- 'Initialize page counter and records per page '------------------------------- iRecordsPerPage = 200 iCounter = 0 '------------------------------- ' Process page scroller '------------------------------- iPage = GetParam("Formtypeextraction_Page") if IsEmpty(iPage) then iPage = 1 else iPage = CLng(iPage) while not rs.eof and iCounter < (iPage-1)*iRecordsPerPage rs.movenext iCounter = iCounter + 1 wend iCounter = 0 '------------------------------- '------------------------------- ' Display grid based on recordset '------------------------------- while not rs.EOF and iCounter < iRecordsPerPage '------------------------------- ' Create field variables based on database fields '------------------------------- fldDescription = GetValue(rs, "t_Description") fldid = GetValue(rs, "t_id") fldName_URLLink = "typeextraction.asp" fldName_id = GetValue(rs, "t_id") fldName = GetValue(rs, "t_Name") '------------------------------- ' typeextraction Show begin '------------------------------- '------------------------------- ' typeextraction Show Event start ' typeextraction Show Event end '------------------------------- '------------------------------- ' Process the HTML controls '------------------------------- %> <% '------------------------------- ' typeextraction Show end '------------------------------- '------------------------------- ' Move to the next record and increase record counter '------------------------------- rs.MoveNext iCounter = iCounter + 1 wend '------------------------------- '------------------------------- ' Process the bottom on the Grid. The insert link and record navigator. '------------------------------- %>
<%=sFormTitle%>
Name Description
No records
<%=fldName%>  <%=ToHTML(fldDescription)%> 
Insert       <% '------------------------------- ' typeextraction Navigation begin '------------------------------- bEof = rs.eof if not(rs.EOF and iPage=1) then if iPage = 1 then %> Previous <% else %> Previous <% end if response.write " [ " & iPage & " ] " if bEof then %> Next <% else %> Next <% end if end if '------------------------------- ' typeextraction Navigation end '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing %>
<% '------------------------------- ' typeextraction Close Event start ' typeextraction Close Event end '------------------------------- end sub '=============================== '=============================== ' Action of the Record Form '------------------------------- Sub typeextraction1Action(sAction) '------------------------------- ' Initialize variables '------------------------------- Dim bExecSQL: bExecSQL = true Dim sActionFileName : sActionFileName = "" Dim sWhere : sWhere = "" Dim bErr : bErr = False Dim pPKid : pPKid = "" Dim fldName : fldName = "" Dim fldDescription : fldDescription = "" '------------------------------- '------------------------------- ' typeextraction1 Action begin '------------------------------- sActionFileName = "typeextraction.asp" '------------------------------- ' CANCEL action '------------------------------- if sAction = "cancel" then '------------------------------- ' typeextraction1 BeforeCancel Event start ' typeextraction1 BeforeCancel Event end '------------------------------- cn.Close Set cn = Nothing response.redirect sActionFileName end if '------------------------------- '------------------------------- ' Build WHERE statement '------------------------------- if sAction = "update" or sAction = "delete" then pPKid = GetParam("PK_id") if IsEmpty(pPKid) then exit sub sWhere = "id=" & ToSQL(pPKid, "Number") end if '------------------------------- '------------------------------- ' Load all form fields into variables '------------------------------- fldName = GetParam("Name") fldDescription = GetParam("Description") '------------------------------- ' Validate fields '------------------------------- if sAction = "insert" or sAction = "update" then if IsEmpty(fldName) then stypeextraction1Err = stypeextraction1Err & "The value in field Name is required.
" end if '------------------------------- ' typeextraction1 Check Event start ' typeextraction1 Check Event end '------------------------------- If len(stypeextraction1Err) > 0 then exit sub end if end if '------------------------------- '------------------------------- ' Create SQL statement '------------------------------- select case sAction case "insert" '------------------------------- ' typeextraction1 Insert Event start ' typeextraction1 Insert Event end '------------------------------- sSQL = "insert into typeextraction (" & _ "Name," & _ "Description)" & _ " values (" & _ ToSQL(fldName, "Text") & "," & _ ToSQL(fldDescription, "Text") & _ ")" case "update" '------------------------------- ' typeextraction1 Update Event start ' typeextraction1 Update Event end '------------------------------- sSQL = "update typeextraction set " & _ "Name=" & ToSQL(fldName, "Text") & _ ",Description=" & ToSQL(fldDescription, "Text") sSQL = sSQL & " where " & sWhere end select '------------------------------- '------------------------------- ' typeextraction1 BeforeExecute Event start ' typeextraction1 BeforeExecute Event end '------------------------------- '------------------------------- ' Execute SQL statement '------------------------------- if len(stypeextraction1Err) > 0 then Exit Sub on error resume next if bExecSQL then cn.execute sSQL end if stypeextraction1Err = ProcessError on error goto 0 if len(stypeextraction1Err) > 0 then Exit Sub cn.Close Set cn = Nothing response.redirect sActionFileName '------------------------------- ' typeextraction1 Action end '------------------------------- end sub '=============================== '=============================== ' Display Record Form '------------------------------- Sub typeextraction1_Show() '------------------------------- ' typeextraction1 Show begin '------------------------------- sWhere = "" Dim sFormTitle: sFormTitle = "Insert / Modify" bPK = true %> <% if not (stypeextraction1Err = "") then %> <% end if %> <% '------------------------------- ' Load primary key and form parameters '------------------------------- if stypeextraction1Err = "" then fldid = GetParam("id") pid = GetParam("id") else fldid = GetParam("id") fldName = GetParam("Name") fldDescription = GetParam("Description") pid = GetParam("PK_id") end if '------------------------------- ' Load all form fields '------------------------------- '------------------------------- ' Build WHERE statement if IsEmpty(pid) then bPK = False sWhere = sWhere & "id=" & ToSQL(pid, "Number") PK_id = pid '------------------------------- '------------------------------- ' typeextraction1 Open Event start ' typeextraction1 Open Event end '------------------------------- '------------------------------- ' Build SQL statement and open recordset '------------------------------- sSQL = "select * from typeextraction where " & sWhere openrs rs, sSQL bIsUpdateMode = (bPK and not(sAction = "insert" and sForm = "typeextraction1") and not rs.eof) '------------------------------- '------------------------------- ' Load all fields into variables from recordset or input parameters '------------------------------- if bIsUpdateMode then fldid = GetValue(rs, "id") '------------------------------- ' Load data from recordset when form displayed first time '------------------------------- if stypeextraction1Err = "" then fldName = GetValue(rs, "Name") fldDescription = GetValue(rs, "Description") end if '------------------------------- ' typeextraction1 ShowEdit Event start ' typeextraction1 ShowEdit Event end '------------------------------- else if stypeextraction1Err = "" then fldid = ToHTML(GetParam("id")) end if '------------------------------- ' typeextraction1 ShowInsert Event start ' typeextraction1 ShowInsert Event end '------------------------------- end if '------------------------------- ' typeextraction1 Show Event start ' typeextraction1 Show Event end '------------------------------- '------------------------------- ' Show form fields '------------------------------- %>
<%=sFormTitle%>
<%= stypeextraction1Err %>
Name
Description
<% if not bIsUpdateMode then %> <% end if %> <% if bIsUpdateMode then %> <% end if %>
<% '------------------------------- ' typeextraction1 Close Event start ' typeextraction1 Close Event end '------------------------------- Set rs = Nothing '------------------------------- ' typeextraction1 Show end '------------------------------- End Sub '=============================== %>