<%@ Language=VBScript %>
" > ">
<% On Error Resume Next Dim oCat, strADOXTableName call GetADOXConnection message="" mypage=Request.Form("targetpagenumber") if mypage="" then _ mypage=1 myaction=Request.Form("todo") if myaction="view" or myaction="deleteimage" then _ myaction="edit" ' open database connection Set rs = server.CreateObject ("ADODB.Recordset") set dbConnection = server.CreateObject ("ADODB.Connection") dbConnection.ConnectionString = strConnection dbConnection.Open Call ReportError ' delete image if Request.Form("saveid")<>"" and Request.Form("todo")="deleteimage" then strSQL="update " & strTableName & " set " & AddWrappers(Request.Form("imagefield")) & " = NULL " strSQL = strSQL & " where " & AddWrappers(strKeyField) & "=" & gstrQuote & Replace(Request.Form("saveid"),"'","''") & gstrQuote if strKeyField2<>"" then _ strSQL = strSQL & " and " & AddWrappers(strKeyField2) & "=" & gstrQuote2 & Replace(Request.Form("saveid2"),"'","''") & gstrQuote2 if strKeyField3<>"" then _ strSQL = strSQL & " and " & AddWrappers(strKeyField3) & "=" & gstrQuote3 & Replace(Request.Form("saveid3"),"'","''") & gstrQuote3 LogInfo(strSQL) dbConnection.Execute strSQL Call ReportError message="
<<< Record was saved >>>
" end if ' save changes if (Request.Form("saveid")<>"" and Request.Form("todo")="edit") then strSQL="update " & strTableName & " set " For i = 1 to Request.Form("FieldName").Count do while Request.Form("Updatable")(i)<>"True" or _ GetEditFormat(Request.Form("FieldName")(i))=EDIT_FORMAT_READONLY i=i+1 if i>=Request.Form("FieldName").Count then exit do loop if i>Request.Form("FieldName").Count then exit for nType = Request.Form("FieldType")(i) strSQL=strSQL & AddWrappers(Request.Form("FieldName")(i)) & "=" ' boolean if nType="11" or (nType="131" and Left(Request.Form(Request.Form("FieldName")(i)),1)="o") then if Request.Form(Request.Form("FieldName")(i))="on" then strValue="1" else strValue="0" end if else ' not boolean if Request.Form(Request.Form("FieldName")(i))="" and ( nType=72 or nType=133 or nType=134 or nType=135 ) then strValue = "NULL" else if (Request.Form("NeedQuotes")(i))="True" then strValue= "'" & Replace( Request.Form(Request.Form("FieldName")(i)) , "'", "''") & "'" else if Request.Form(Request.Form("FieldName")(i))="" then strValue="0" else strValue=Request.Form(Request.Form("FieldName")(i)) end if end if end if end if strSQL = strSQL & strValue if i<>Request.Form("FieldName").Count then _ strSQL = strSQL & ", " Next if Right(strSQL,2)= ", " then strSQL = Left(strSQL, Len(strSQL)-2) '1 strSQL = strSQL & " where " & AddWrappers(strKeyField) & "=" & gstrQuote & Replace(Request.Form("saveid"),"'","''") & gstrQuote if strKeyField2<>"" then _ strSQL = strSQL & " and " & AddWrappers(strKeyField2) & "=" & gstrQuote2 & Replace(Request.Form("saveid2"),"'","''") & gstrQuote2 if strKeyField3<>"" then _ strSQL = strSQL & " and " & AddWrappers(strKeyField3) & "=" & gstrQuote3 & Replace(Request.Form("saveid3"),"'","''") & gstrQuote3 LogInfo(strSQL) dbConnection.Execute strSQL Call ReportError message="
<<< Record was saved >>>
" end if sMode = "Edit" strSQL="select " if InStr(1, LCase(strSQL), LCase(AddWrappers(strKeyField)))<1 then strSQL = "select " & AddWrappers(strKeyField) & ", " & Mid(strSQL, 8) if strKeyField2<>"" and InStr(1, LCase(strSQL), LCase(AddWrappers(strKeyField2)))<1 then strSQL = "select " & AddWrappers(strKeyField2) & ", " & Mid(strSQL, 8) if strKeyField3<>"" and InStr(1, LCase(strSQL), LCase(AddWrappers(strKeyField3)))<1 then strSQL = "select " & AddWrappers(strKeyField3) & ", " & Mid(strSQL, 8) if Right(strSQL,2)= ", " then strSQL = Left(strSQL, Len(strSQL)-2) '1 strSQL = strSQL & " from " & strTableName strSQL=strSQL & " where " & AddWrappers(strKeyField) & "=" & gstrQuote & Replace(request.form("editid"),"'","''") & gstrQuote if strKeyField2<>"" then _ strSQL=strSQL & " and " & AddWrappers(strKeyField2) & "=" & gstrQuote2 & Replace(request.form("editid2"),"'","''") & gstrQuote2 if strKeyField3<>"" then _ strSQL=strSQL & " and " & AddWrappers(strKeyField3) & "=" & gstrQuote3 & Replace(request.form("editid3"),"'","''") & gstrQuote3 Response.Write "

Edit record [" & strKeyField & ": " & request.form("editid") & "]

" response.write message response.write "

" LogInfo(strSQL) rs.open strSQL, dbConnection Call ReportError Response.write "   Back to list

" Response.Write "" %> " > "> "> "> "> "> "> "> name=NeedQuotes<%=BuildFieldName(strKeyField)%> value="<%=Request.Form("NeedQuotes" & BuildFieldName(strKeyField))%>"> <% if strKeyField2<>"" then %> name=NeedQuotes<%=BuildFieldName(strKeyField2)%> value="<%=Request.Form("NeedQuotes" & BuildFieldName(strKeyField2))%>"> <% end if %> <% if strKeyField3<>"" then %> name=NeedQuotes<%=BuildFieldName(strKeyField3)%> value="<%=Request.Form("NeedQuotes" & BuildFieldName(strKeyField3))%>"> <% end if %> <% strPK = AddWrappers(strKeyField) if strKeyField2<>"" then strPK = strPK & "," & AddWrappers(strKeyField2) if strKeyField3<>"" then strPK = strPK & "," & AddWrappers(strKeyField3) if strADOXTableName<>"" then set oCat=Nothing %>
>


- required field