%Option Explicit%> <% Dim Status, Password Response.Buffer = True STATUS = Request("STATUS") PASSWORD = Request("PASSWORD") %> <% If STATUS = "CHECKEM" Then If PASSWORD = "editme" THEN Session("PASSWORDACCESS") = "Yes" End If End If %> <% If Session("PASSWORDACCESS") <> "Yes" Then %>
| LINK Systems Personnel Only |
444 McNally Dr. Nashville, TN 37211
Phone 615-833-4168 Fax 615-834-1984
Copyright © 2002
Note: Watch your input... the text field is small and no error handling is done to check for dates. If an error gets thrown when you submit simply hit back and fix the offending entry before resubmitting.
<% Response.Write(RecordListing) Case "insert" ' Part 2 of 2 for adding a new record. Insert from form. OpenConnection() strSQL = "INSERT INTO " & strDbTable _ & " (fUrlClass,fUrlLink,fUrlText,fUrlDateEntered,fUrlActive)" & " VALUES ("_ & chr(39) & Request.Form("fUrlClass") & chr(39) & ","_ & chr(39) & Request.Form("fUrlLink") & chr(39) & ","_ & chr(39) & Request.Form("fUrlText") & chr(39) & ","_ & chr(35) & Request.Form("fUrlDateEntered") & chr(35) & ","_ & Request.Form("fUrlActive") & ")" ' chr(34) " for Access ' chr(35) # for Access dates ' chr(39) ' for Access ' Response.Write(strSQL) ' Debugging line rstLink.Open strSQL, cnnLinkDB, 3, 3 Response.Write("Note: Watch your input... the text field is small and no error handling is done to check for valid integers or dates. If an error gets thrown when you submit simply hit back and fix the offending entry before resubmitting.
<% Else Response.Write "Record not found!" End If Response.Write(RecordListing) ' Don't use CloseConnection() Case "editsave" ' Part 2 of 2: Here's where we save the values that the ' user entered back to the DB. Again... no error ' handling or input checking so ' characters and invalid ' values will throw error messages. iRecordId = Request.Form("fUrlId") OpenConnection() strSQL = "UPDATE " & strDbTable & " SET "_ & "fUrlClass = " & chr(39) & Request.Form("fUrlClass") & chr(39) & ", "_ & "fUrlText = " & chr(39) & Request.Form("fUrlText") & chr(39) & ", "_ & "fUrlLink = " & chr(39) & Request.Form("fUrlLink") & chr(39) & ", "_ & "fUrlDateEntered = " & chr(35) & Request.Form("fUrlDateEntered") & chr(35) & ", "_ & "fUrlActive = " & Request.Form("fUrlActive") & " "_ & "WHERE (fUrlId = " & iRecordId & ")" ' Response.Write(strSQL) ' Debugging line ' If something does throw an error, checking this is ' actually a valid command often helps debug. rstLink.Open strSQL, cnnLinkDB, 3, 3 ' Don't use CloseConnection() Response.Write("| Add a new record | ||||
|---|---|---|---|---|
| Class | Text | Active | ||
| <%= rstLink.Fields("fUrlClass").Value %> | <%= rstLink.Fields("fUrlText").Value %> | <%= rstLink.Fields("fUrlActive").Value %> | ">Delete | ">Edit |
| <% Response.Write rstLink.RecordCount %> Total Records | ||||