<% 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 ' Get action a = Request.Form("a") If (a = "" Or IsNull(a)) Then key = Request.Querystring("key") If key <> "" Then a = "C" ' Copy record Else a = "I" ' Display blank record End If End If ' Open Connection to the database Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str Select Case a Case "C": ' 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 ' Get the field contents 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") End If rs.Close Set rs = Nothing Case "A": ' Add ' 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 record strsql = "SELECT * FROM [properties] WHERE 0 = 1" Set rs = Server.CreateObject("ADODB.Recordset") rs.Open strsql, conn, 1, 2 rs.AddNew 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 %>

Add to TABLE: properties

Back to List

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