<% 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 = "research_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_research" '============================================== '======= including the HeaderTableStart '============================================== HeaderTableTitle = "Research: 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 = "topic" textareawidth = "100%" textareaheight = "50px" %>

<% textareaname = "msg" textareawidth = "100%" textareaheight = "200px" %>
> Show

<% Case "edit_save": topic = request.form("topic") 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 thetopic='"&topic&"', 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 "insertafter": rowid = request.querystring("rowid") orderid = request.querystring("orderid") lr = request.querystring("lr") %>
Inserting a new row after row # <%=rowid%>

  Topic <% textareaname = "topic" textareawidth = "100%" textareaheight = "50px" %>
  Text

 


<% textareaname = "msg" textareawidth = "100%" textareaheight = "200px" %>
 Show Show

<% Case "insertafter_insert": topic = request.form("topic") msg = request.form("msg") orderid = request.querystring("orderid") lr = request.querystring("lr") show = request.form("show") if show = "ON" then show = 1 else show = 0 end if ' If the current row is the last row, then jump to the new page with the new row if lr = "T" then PageNum = PageNum + 1 '''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''' In executing query: if there is Error Resume Next '''''''''''''''''''''''''''''''''''''''''''''''''''''''' On Error Resume Next selectSQL = "SELECT * FROM "&dbTable&" WHERE orderid > "&orderid&" ORDER BY orderid" set rs=ADO.execute(selectSQL) do while not rs.eof updateSQL= "UPDATE "&dbTable&" SET orderid="&rs("orderid")+1&" WHERE id="&rs("id") ADO.execute(updateSQL) rs.movenext loop addSQL= "INSERT INTO "&dbTable&" (orderid, thetopic, thetext ,show) VALUES ("&orderid+1&" , '"&topic&"', '"&msg&"','"&show&"')" ADO.execute(addSQL) if err.number = 0 then writeMSG "Insertion 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 orderid" ' this line must set here, to be checked later infobarPage = Page ' where the links will be directed infobarPageNum = PageNum infobarRowsPerPage = 20 infobarMessage = "No text for this section!" %><% '==============================================%> <%''''''''''''''''''''''''''''''''''''''''''''' '''''' [if NOT rs.eof] Statement ''''''''''''''''''''''''''''''''''''''''''''''' if NOT rs.eof then%>
# Topic Text actions
<%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("thetopic")%>

<%=rs("thetext")%>

&value=<%=rs("show")%>'">" name="R1" <% if rs("show")=true then response.write " checked "%>> "> &rowid=<%=rowid%>"> <% ' Check if this row is the last row lr = "F" ' false if cint(rowid) mod cint(infobarRowsPerPage) = 0 then lr = "T" ' True %> &rowid=<%=rowid%>&lr=<%=lr%>">
<% 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 %>