<%@ 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="" then myaction="add" if myaction="add" then _ myaction="added" ' open database connection Set rs = server.CreateObject ("ADODB.Recordset") set dbConnection = server.CreateObject ("ADODB.Connection") dbConnection.ConnectionString = strConnection dbConnection.Open Call ReportError ' insert new record if we have to if Request.Form("todo")="added" then strSQL = "insert into " & strTableName & " " strFields = "(" strValues = "(" ' fields list For i = 1 To Request.Form("FieldName").Count ' skip key fields do while Request.Form("Updatable")(i)<>"True" i=i+1 if i>=Request.Form("FieldName").Count then exit do loop if i>Request.Form("FieldName").Count then exit for strFields=strFields & AddWrappers(Request.Form("FieldName")(i)) & ", " nType = Request.Form("FieldType")(i) ' build list of values ' boolean if Request.Form("FieldType")(i)="11" or _ (Request.Form("FieldType")(i)="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 ' Date or GUID field with no value 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 strValues = strValues & strValue & ", " Next ' adjust strFields and strValues if Right(strFields,2)=", " then strFields = Left(strFields, Len(strFields)-2) if Right(strValues,2)=", " then strValues = Left(strValues, Len(strValues)-2) strFields = strFields & ")" strValues = strValues & ")" strSQL = strSQL & strFields & " values " & strValues LogInfo(strSQL) dbConnection.Execute strSQL Call ReportError message="
<<< Il Record è stato aggiunto >>>
" end if sMode = "Add" strSQL="select " & AddWrappers("ID") & ", " & AddWrappers("Username") & ", " & AddWrappers("Password") & ", " & AddWrappers("accesso") & ", " & AddWrappers("lista") & ", " & AddWrappers("pin") & ", " if InStr(1, LCase(strSQL), LCase(AddWrappers(strKeyField)))<1 then strSQL = "select " & AddWrappers(strKeyField) & ", " & Mid(strSQL, 8) '1 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) strSQL = strSQL & " from " & strTableName & " where 1<0" Response.Write "

Add new record

" 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 %> <% sFieldName = "ID" if rs.EOF and rs.BOF then strValue="" else strValue = GetData(rs.Fields(sFieldName), FORMAT_NONE ) end if if GetEditFormat(sFieldName) <> EDIT_FORMAT_HIDDEN then Response.Write vbCRLF & "" else Response.Write BuildEditControl(rs.Fields(sFieldName), strValue, GetEditFormat(sFieldName), sMode) end if sFieldName = "Username" if rs.EOF and rs.BOF then strValue="" else strValue = GetData(rs.Fields(sFieldName), FORMAT_NONE ) end if if GetEditFormat(sFieldName) <> EDIT_FORMAT_HIDDEN then Response.Write vbCRLF & "" else Response.Write BuildEditControl(rs.Fields(sFieldName), strValue, GetEditFormat(sFieldName), sMode) end if sFieldName = "Password" if rs.EOF and rs.BOF then strValue="" else strValue = GetData(rs.Fields(sFieldName), FORMAT_NONE ) end if if GetEditFormat(sFieldName) <> EDIT_FORMAT_HIDDEN then Response.Write vbCRLF & "" else Response.Write BuildEditControl(rs.Fields(sFieldName), strValue, GetEditFormat(sFieldName), sMode) end if sFieldName = "accesso" if rs.EOF and rs.BOF then strValue="" else strValue = GetData(rs.Fields(sFieldName), FORMAT_NONE ) end if if GetEditFormat(sFieldName) <> EDIT_FORMAT_HIDDEN then Response.Write vbCRLF & "" else Response.Write BuildEditControl(rs.Fields(sFieldName), strValue, GetEditFormat(sFieldName), sMode) end if sFieldName = "lista" if rs.EOF and rs.BOF then strValue="" else strValue = GetData(rs.Fields(sFieldName), FORMAT_NONE ) end if if GetEditFormat(sFieldName) <> EDIT_FORMAT_HIDDEN then Response.Write vbCRLF & "" else Response.Write BuildEditControl(rs.Fields(sFieldName), strValue, GetEditFormat(sFieldName), sMode) end if sFieldName = "pin" if rs.EOF and rs.BOF then strValue="" else strValue = GetData(rs.Fields(sFieldName), FORMAT_NONE ) end if if GetEditFormat(sFieldName) <> EDIT_FORMAT_HIDDEN then Response.Write vbCRLF & "" else Response.Write BuildEditControl(rs.Fields(sFieldName), strValue, GetEditFormat(sFieldName), sMode) end if if strADOXTableName<>"" then set oCat=Nothing %>
" Response.Write Label(sFieldName) & " " Response.Write "" end if nType = rs.Fields(sFieldName).Type strNeedQuotes = IfNeedQuotes(nType) bUpdatable = IsUpdatable(rs.Fields(sFieldName)) Response.Write "" Response.Write "" Response.Write "" Response.Write "" if GetEditFormat(sFieldName) <> EDIT_FORMAT_HIDDEN then strEncoded = HTMLEncode(strValue) if bUpdatable then Response.Write BuildEditControl(rs.Fields(sFieldName), strValue, GetEditFormat(sFieldName), sMode) else if IsBinaryField(rs.Fields(sFieldName)) or Format(rs.Fields(sFieldName).Name)=FORMAT_DATABASE_FILE then Response.Write CreateImageControl(rs, rs.Fields(sFieldName).Name, "") else Response.Write Replace(strEncoded, vbcrlf, "
") end if end if ' add icons if required Response.Write GetLegendIcon(sFieldName, nType, i) Response.Write "
" Response.Write Label(sFieldName) & " " Response.Write "" end if nType = rs.Fields(sFieldName).Type strNeedQuotes = IfNeedQuotes(nType) bUpdatable = IsUpdatable(rs.Fields(sFieldName)) Response.Write "" Response.Write "" Response.Write "" Response.Write "" if GetEditFormat(sFieldName) <> EDIT_FORMAT_HIDDEN then strEncoded = HTMLEncode(strValue) if bUpdatable then Response.Write BuildEditControl(rs.Fields(sFieldName), strValue, GetEditFormat(sFieldName), sMode) else if IsBinaryField(rs.Fields(sFieldName)) or Format(rs.Fields(sFieldName).Name)=FORMAT_DATABASE_FILE then Response.Write CreateImageControl(rs, rs.Fields(sFieldName).Name, "") else Response.Write Replace(strEncoded, vbcrlf, "
") end if end if ' add icons if required Response.Write GetLegendIcon(sFieldName, nType, i) Response.Write "
" Response.Write Label(sFieldName) & " " Response.Write "" end if nType = rs.Fields(sFieldName).Type strNeedQuotes = IfNeedQuotes(nType) bUpdatable = IsUpdatable(rs.Fields(sFieldName)) Response.Write "" Response.Write "" Response.Write "" Response.Write "" if GetEditFormat(sFieldName) <> EDIT_FORMAT_HIDDEN then strEncoded = HTMLEncode(strValue) if bUpdatable then Response.Write BuildEditControl(rs.Fields(sFieldName), strValue, GetEditFormat(sFieldName), sMode) else if IsBinaryField(rs.Fields(sFieldName)) or Format(rs.Fields(sFieldName).Name)=FORMAT_DATABASE_FILE then Response.Write CreateImageControl(rs, rs.Fields(sFieldName).Name, "") else Response.Write Replace(strEncoded, vbcrlf, "
") end if end if ' add icons if required Response.Write GetLegendIcon(sFieldName, nType, i) Response.Write "
" Response.Write Label(sFieldName) & " " Response.Write "" end if nType = rs.Fields(sFieldName).Type strNeedQuotes = IfNeedQuotes(nType) bUpdatable = IsUpdatable(rs.Fields(sFieldName)) Response.Write "" Response.Write "" Response.Write "" Response.Write "" if GetEditFormat(sFieldName) <> EDIT_FORMAT_HIDDEN then strEncoded = HTMLEncode(strValue) if bUpdatable then Response.Write BuildEditControl(rs.Fields(sFieldName), strValue, GetEditFormat(sFieldName), sMode) else if IsBinaryField(rs.Fields(sFieldName)) or Format(rs.Fields(sFieldName).Name)=FORMAT_DATABASE_FILE then Response.Write CreateImageControl(rs, rs.Fields(sFieldName).Name, "") else Response.Write Replace(strEncoded, vbcrlf, "
") end if end if ' add icons if required Response.Write GetLegendIcon(sFieldName, nType, i) Response.Write "
" Response.Write Label(sFieldName) & " " Response.Write "" end if nType = rs.Fields(sFieldName).Type strNeedQuotes = IfNeedQuotes(nType) bUpdatable = IsUpdatable(rs.Fields(sFieldName)) Response.Write "" Response.Write "" Response.Write "" Response.Write "" if GetEditFormat(sFieldName) <> EDIT_FORMAT_HIDDEN then strEncoded = HTMLEncode(strValue) if bUpdatable then Response.Write BuildEditControl(rs.Fields(sFieldName), strValue, GetEditFormat(sFieldName), sMode) else if IsBinaryField(rs.Fields(sFieldName)) or Format(rs.Fields(sFieldName).Name)=FORMAT_DATABASE_FILE then Response.Write CreateImageControl(rs, rs.Fields(sFieldName).Name, "") else Response.Write Replace(strEncoded, vbcrlf, "
") end if end if ' add icons if required Response.Write GetLegendIcon(sFieldName, nType, i) Response.Write "
" Response.Write Label(sFieldName) & " " Response.Write "" end if nType = rs.Fields(sFieldName).Type strNeedQuotes = IfNeedQuotes(nType) bUpdatable = IsUpdatable(rs.Fields(sFieldName)) Response.Write "" Response.Write "" Response.Write "" Response.Write "" if GetEditFormat(sFieldName) <> EDIT_FORMAT_HIDDEN then strEncoded = HTMLEncode(strValue) if bUpdatable then Response.Write BuildEditControl(rs.Fields(sFieldName), strValue, GetEditFormat(sFieldName), sMode) else if IsBinaryField(rs.Fields(sFieldName)) or Format(rs.Fields(sFieldName).Name)=FORMAT_DATABASE_FILE then Response.Write CreateImageControl(rs, rs.Fields(sFieldName).Name, "") else Response.Write Replace(strEncoded, vbcrlf, "
") end if end if ' add icons if required Response.Write GetLegendIcon(sFieldName, nType, i) Response.Write "
>


- Campo richiesto