<% ' ' Filename: reponsequestion.asp ' Generated with CodeCharge 2.0.5 ' ASP 2.0.ccp build 01/22/2002 ' '------------------------------- ' reponsequestion CustomIncludes begin %> <% ' reponsequestion CustomIncludes end '------------------------------- '=============================== ' Save Page and File Name available into variables '------------------------------- sFileName = "reponsequestion.asp" '=============================== '=============================== ' reponsequestion PageSecurity begin CheckSecurity(1) ' reponsequestion PageSecurity end '=============================== '=============================== ' reponsequestion Open Event start ' reponsequestion Open Event end '=============================== '=============================== ' reponsequestion OpenAnyPage Event start ' reponsequestion OpenAnyPage Event end '=============================== '=============================== ' Save the name of the form and type of action into the variables '------------------------------- sAction = GetParam("FormAction") sForm = GetParam("FormName") '=============================== ' reponsequestion Show begin '=============================== ' Page execution '------------------------------- 'Initialize error variables '------------------------------- sreponsequestion1Err = "" '------------------------------- ' Select the FormAction '------------------------------- Select Case sForm Case "reponsequestion1" reponsequestion1Action(sAction) end select '=============================== '=============================== ' HTML Page layout '------------------------------- %> EB Customers 1.09
<% MenuGeneral2_Show %>
<% MenuGeneral_Show %>
<% reponsequestion_Show %>
<% reponsequestion1_Show %>
<% ' reponsequestion Show end ' reponsequestion Close Event start ' reponsequestion Close Event end '------------------------------- ' Destroy connection object '------------------------------- cn.close Set cn = nothing '=============================== '******************************************************************************** '=============================== ' Display Grid Form '------------------------------- Sub reponsequestion_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "reponse question" 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 = 20 Dim iCounter : iCounter = 0 Dim iPage : iPage = 0 Dim bEof : bEof = False Dim sActionFileName : sActionFileName = "reponsequestion.asp" Dim transit_params : transit_params = "" Dim form_params : form_params = "" '------------------------------- ' Build ORDER BY statement '------------------------------- sOrder = " order by r.Name Asc" iSort = GetParam("Formreponsequestion_Sorting") iSorted = GetParam("Formreponsequestion_Sorted") sDirection = "" if IsEmpty(iSort) then form_sorting = "" else if iSort = iSorted then form_sorting = "" sDirection = " DESC" sSortParams = "Formreponsequestion_Sorting=" & iSort & "&Formreponsequestion_Sorted=" & iSort & "&" else form_sorting = iSort sDirection = " ASC" sSortParams = "Formreponsequestion_Sorting=" & iSort & "&Formreponsequestion_Sorted=" & "&" end if if iSort = 1 then sOrder = " order by r.Name" & sDirection end if '------------------------------- ' HTML column headers '------------------------------- %> <% '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select r.Name as r_Name, " & _ "r.id as r_id " & _ " from reponsequestion r " '------------------------------- '------------------------------- ' reponsequestion Open Event start ' reponsequestion 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 = 20 iCounter = 0 '------------------------------- ' Process page scroller '------------------------------- iPage = GetParam("Formreponsequestion_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 '------------------------------- fldid = GetValue(rs, "r_id") fldName_URLLink = "reponsequestion.asp" fldName_id = GetValue(rs, "r_id") fldName = GetValue(rs, "r_Name") '------------------------------- ' reponsequestion Show begin '------------------------------- '------------------------------- ' reponsequestion Show Event start ' reponsequestion Show Event end '------------------------------- '------------------------------- ' Process the HTML controls '------------------------------- %> <% '------------------------------- ' reponsequestion 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
No records
<%=fldName%> 
Insert       <% '------------------------------- ' reponsequestion 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 '------------------------------- ' reponsequestion Navigation end '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing %>
<% '------------------------------- ' reponsequestion Close Event start ' reponsequestion Close Event end '------------------------------- end sub '=============================== '=============================== ' Action of the Record Form '------------------------------- Sub reponsequestion1Action(sAction) '------------------------------- ' Initialize variables '------------------------------- Dim bExecSQL: bExecSQL = true Dim sActionFileName : sActionFileName = "" Dim sWhere : sWhere = "" Dim bErr : bErr = False Dim pPKid : pPKid = "" Dim fldName : fldName = "" '------------------------------- '------------------------------- ' reponsequestion1 Action begin '------------------------------- sActionFileName = "reponsequestion.asp" '------------------------------- ' CANCEL action '------------------------------- if sAction = "cancel" then '------------------------------- ' reponsequestion1 BeforeCancel Event start ' reponsequestion1 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") '------------------------------- ' Validate fields '------------------------------- if sAction = "insert" or sAction = "update" then if IsEmpty(fldName) then sreponsequestion1Err = sreponsequestion1Err & "The value in field Name is required.
" end if '------------------------------- ' reponsequestion1 Check Event start ' reponsequestion1 Check Event end '------------------------------- If len(sreponsequestion1Err) > 0 then exit sub end if end if '------------------------------- '------------------------------- ' Create SQL statement '------------------------------- select case sAction case "insert" '------------------------------- ' reponsequestion1 Insert Event start ' reponsequestion1 Insert Event end '------------------------------- sSQL = "insert into reponsequestion (" & _ "Name)" & _ " values (" & _ ToSQL(fldName, "Text") & _ ")" case "update" '------------------------------- ' reponsequestion1 Update Event start ' reponsequestion1 Update Event end '------------------------------- sSQL = "update reponsequestion set " & _ "Name=" & ToSQL(fldName, "Text") sSQL = sSQL & " where " & sWhere end select '------------------------------- '------------------------------- ' reponsequestion1 BeforeExecute Event start ' reponsequestion1 BeforeExecute Event end '------------------------------- '------------------------------- ' Execute SQL statement '------------------------------- if len(sreponsequestion1Err) > 0 then Exit Sub on error resume next if bExecSQL then cn.execute sSQL end if sreponsequestion1Err = ProcessError on error goto 0 if len(sreponsequestion1Err) > 0 then Exit Sub cn.Close Set cn = Nothing response.redirect sActionFileName '------------------------------- ' reponsequestion1 Action end '------------------------------- end sub '=============================== '=============================== ' Display Record Form '------------------------------- Sub reponsequestion1_Show() '------------------------------- ' reponsequestion1 Show begin '------------------------------- sWhere = "" Dim sFormTitle: sFormTitle = "Insert / Modify" bPK = true %> <% if not (sreponsequestion1Err = "") then %> <% end if %> <% '------------------------------- ' Load primary key and form parameters '------------------------------- if sreponsequestion1Err = "" then fldid = GetParam("id") pid = GetParam("id") else fldid = GetParam("id") fldName = GetParam("Name") 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 '------------------------------- '------------------------------- ' reponsequestion1 Open Event start ' reponsequestion1 Open Event end '------------------------------- '------------------------------- ' Build SQL statement and open recordset '------------------------------- sSQL = "select * from reponsequestion where " & sWhere openrs rs, sSQL bIsUpdateMode = (bPK and not(sAction = "insert" and sForm = "reponsequestion1") 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 sreponsequestion1Err = "" then fldName = GetValue(rs, "Name") end if '------------------------------- ' reponsequestion1 ShowEdit Event start ' reponsequestion1 ShowEdit Event end '------------------------------- else if sreponsequestion1Err = "" then fldid = ToHTML(GetParam("id")) end if '------------------------------- ' reponsequestion1 ShowInsert Event start ' reponsequestion1 ShowInsert Event end '------------------------------- end if '------------------------------- ' reponsequestion1 Show Event start ' reponsequestion1 Show Event end '------------------------------- '------------------------------- ' Show form fields '------------------------------- %>
<%=sFormTitle%>
<%= sreponsequestion1Err %>
Name
<% if not bIsUpdateMode then %> <% end if %> <% if bIsUpdateMode then %> <% end if %>
<% '------------------------------- ' reponsequestion1 Close Event start ' reponsequestion1 Close Event end '------------------------------- Set rs = Nothing '------------------------------- ' reponsequestion1 Show end '------------------------------- End Sub '=============================== %>