<% if request.form("vegetarian")= "true" then vegetarian = true else vegetarian = false end if if request.form("rotw")<> "" then rotw = ", rotw=#"& CDate(request.form("rotw")) & "# " else rotw = "" end if set conn=server.createObject("ADODB.connection") conn.open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\") & "\data\NothingToIt.mdb;UID=;PWD=;" 'this next section was meant to turn the new recipe on and the other off 'weve changed it since then so that not the ROTW field has a date and the 'live field is no longer used, so this in commented out 'if live = TRUE then 'SQL = "SELECT live, entry_id from recipe_tbl WHERE live = TRUE;" 'set rs=server.createobject("ADODB.recordset") 'rs.open SQL, CONN 'SQL = "UPDATE recipe_tbl SET live = FALSE WHERE entry_id in (" 'TEMPlist = "" ' a list of the records called true ' while not rs.eof ' TEMPlist = Templist & rs("entry_id") & ", " ' rs.movenext ' wend 'templength = LEN(templist) 'TEMPlist = LEFT(TEMPLIST,(templength-2)) ' 'SQL = SQL & TEMPLIST & ");" ' ' 'Set comm=server.createObject("ADODB.command") 'set comm.ActiveConnection = Conn 'comm.commandtext = SQL 'comm.commandType = adCmdText 'comm.execute 'end if SQL = "UPDATE recipe_tbl SET " SQL = SQL & "keywords='" &cleanstring(request.form("keywords")) & "', intro='" & CleanString(request.form("description")) & "', directions='" & cleanstring(request.form("directions")) & "', ingredients='" & cleanstring(request.form("ingredients")) & "', category='" & cleanstring(request.form("category")) & "', boolean_field=" & vegetarian & ", name='" & cleanstring(request.form("name")) & "' "& rotw &" WHERE entry_id=" & request.form("id") & ";" set CmdObj=server.createObject("ADODB.command") set CMDOBJ.ActiveConnection = CONN CMDOBJ.commandtext = SQL CMDOBJ.commandtype = adcmdtext cmdobj.execute 'response.write SQL & "
" response.write "The recipe was successfully updated." 'response.write "
" & Live if not IsEmpty(rs) then rs.close set rs=nothing end if Function CleanString(sqlValue) CleanString = replace(sqlValue, "'", "''") 'Cleanstring = replace(sqlValue, ",", "·") End function %>