<% action = request.querystring("action") ID = request.querystring("ID") show_value = request.querystring("value") PageNum = request.querystring("PageNum") '============================================== '======= Where the links will be directed '======= if there is an action '============================================== Page = "home_edit" '============================================== '======= Where the links will be directed '======= if there is a jump action '======= [e.g. After addition, we need to jump to the edit page] '============================================== Page2 = "none" '============================================== '======= Set the db table belonging to this page '============================================== dbTable = "page_home" '============================================== '======= including the HeaderTableStart '============================================== HeaderTableTitle = "Home: Edit / Delete" %> <% ''''' HeaderTableEnd : must be added after including the HeaderTableStart '============================================== Select Case action Case "show": if show_value = "True" then ' revers the values show_value = 0 else show_value = 1 end if '''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''' In executing query: if there is Error Resume Next '''''''''''''''''''''''''''''''''''''''''''''''''''''''' On Error Resume Next updateSQL= "UPDATE "&dbTable&" SET show = "&show_value&" WHERE id="&ID ADO.execute(updateSQL) if err.number = 0 then writeMSG "Show status done successufly." , "OkType" response.write "
" else writeMSG "Error : "& err.description & " from " & err.source &".", "ErrorType" end if Case "delete": response.write "

Are You sure deleting the following:

" '''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''' In executing query: if there is Error Resume Next '''''''''''''''''''''''''''''''''''''''''''''''''''''''' On Error Resume Next selectSQL = "SELECT * FROM "&dbTable&" WHERE id="&ID set rs=ADO.execute(selectSQL) rowid = request.querystring("rowid") if err.number = 0 then %>

#

Text

<%=rowid%>

<%=rs("thetext")%>

<% response.write "
" response.write "" response.write "
" else writeMSG "Error : "& err.description & " from " & err.source &".", "ErrorType" end if Case "delete_ok": '''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''' In executing query: if there is Error Resume Next '''''''''''''''''''''''''''''''''''''''''''''''''''''''' On Error Resume Next deleteSQL = "DELETE * FROM "&dbTable&" WHERE id="&ID ADO.execute(deleteSQL) if err.number = 0 then writeMSG "Deletion done successufly." , "OkType" response.write "
" else writeMSG "Error : "& err.description & " from " & err.source &".", "ErrorType" end if Case "edit": selectSQL = "SELECT * FROM "&dbTable&" WHERE id="&ID set rs=ADO.execute(selectSQL) ID = ID&"" ' convert it to string %>
Edit
">
<% textareaname = "msg" textareawidth = "100%" textareaheight = "200px" %>
> Show

<% Case "edit_save": msg = request.form("msg") show = request.form("show") if show = "on" then show = 1 else show = 0 end if '''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''' In executing query: if there is Error Resume Next '''''''''''''''''''''''''''''''''''''''''''''''''''''''' On Error Resume Next updateSQL= "UPDATE "&dbTable&" SET thetext='"&msg&"', show ='"&show&"' WHERE id="&ID ADO.execute(updateSQL) if err.number = 0 then writeMSG "Saving done successufly." , "OkType" response.write "
" else writeMSG "Error : "& err.description & " from " & err.source &".", "ErrorType" end if Case ELSE: ' case else start ---------------- '============================================== '======= including the up info bar '============================================== infobarSelectSQL = "SELECT * FROM "&dbTable&" ORDER BY id DESC" ' this line must set here, to be checked later infobarPage = Page ' where the links will be directed infobarPageNum = PageNum infobarRowsPerPage = 5 infobarMessage = "No text for this section!" %><% '==============================================%> <%''''''''''''''''''''''''''''''''''''''''''''' '''''' [if NOT rs.eof] Statement ''''''''''''''''''''''''''''''''''''''''''''''' if NOT rs.eof then%>
# Text show edit delete
<%end if '''''' End of [if NOT rs.eof] Statement '''''''''''''''''''''''''''''''''''''''''''''''%> <% bgcolor = "#CCDDE1" count = 1 rowid = currStart do while not rs.eof AND count <= infobarRowsPerPage %>

<%=rowid%>

<%=rs("thetext")%>

&value=<%=rs("show")%>'">" name="R1" <% if rs("show")=true then response.write " checked "%>> "> &rowid=<%=rowid%>">
<% if bgcolor = "#CCDDE1" then bgcolor = "#ADC9CF" else bgcolor = "#CCDDE1" end if rs.movenext count = count + 1 rowid = rowid + 1 loop rs.close Con.Close set Con = nothing '============================================== '============================================== '======= including the down info bar '============================================== %><% rs.close Con.Close set Con = nothing '============================================== 'case else end------------------- End Select ADO.close Set ADO=Nothing Response.write HeaderTableEnd %>