<% If Session("project1_status") <> "login" Then Response.Redirect "login.asp" %> <% Response.expires = 0 Response.expiresabsolute = Now() - 1 Response.addHeader "pragma", "no-cache" Response.addHeader "cache-control", "private" Response.CacheControl = "no-cache" %> <% Response.Buffer = True key = Request.Querystring("key") If key = "" Or IsNull(key) Then key = Request.Form("key") If key = "" Or IsNull(key) Then Response.Redirect "propertieslist.asp" ' Get action a = Request.Form("a") If a = "" Or IsNull(a) Then a = "I" ' Display with input box End If ' Get fields from form x_propertyID = Request.Form("x_propertyID") x_datelisted = Request.Form("x_datelisted") x_propertyName = Request.Form("x_propertyName") x_mls = Request.Form("x_mls") x_price = Request.Form("x_price") x_status = Request.Form("x_status") x_image = Request.Form("x_image") x_description = Request.Form("x_description") x_link = Request.Form("x_link") ' Open Connection to the database Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str Select Case a Case "I": ' Get a record to display tkey = "" & key & "" strsql = "SELECT * FROM [properties] WHERE [propertyID]=" & tkey Set rs = Server.CreateObject("ADODB.Recordset") rs.Open strsql, conn If rs.Eof Then Response.Clear Response.Redirect "propertieslist.asp" Else rs.MoveFirst End If ' Get the field contents x_propertyID = rs("propertyID") x_datelisted = rs("datelisted") x_propertyName = rs("propertyName") x_mls = rs("mls") x_price = rs("price") x_status = rs("status") x_image = rs("image") x_description = rs("description") x_link = rs("link") rs.Close Set rs = Nothing Case "U": ' Update ' Open record tkey = "" & key & "" strsql = "SELECT * FROM [properties] WHERE [propertyID]=" & tkey Set rs = Server.CreateObject("ADODB.Recordset") rs.Open strsql, conn, 1, 2 If rs.Eof Then Response.Clear Response.Redirect "propertieslist.asp" End If tmpFld = Trim(x_datelisted) If Trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("datelisted") = tmpFld tmpFld = Trim(x_propertyName) If Trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("propertyName") = tmpFld tmpFld = Trim(x_mls) If Trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("mls") = tmpFld tmpFld = Trim(x_price) If Trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("price") = tmpFld tmpFld = Trim(x_status) If Trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("status") = tmpFld tmpFld = Trim(x_image) If Trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("image") = tmpFld tmpFld = Trim(x_description) If Trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("description") = tmpFld tmpFld = Trim(x_link) If Trim(tmpFld) & "x" = "x" Then tmpFld = Null rs("link") = tmpFld rs.Update rs.Close Set rs = Nothing conn.Close Set conn = Nothing Response.Clear Response.Redirect "propertieslist.asp" End Select %>

Edit TABLE: properties

Back to List

property ID  <% Response.Write x_propertyID %> 
datelisted  "> 
property Name   
mls  "> 
price  "> 
status  "> 
image  "> 
description   
link  ">