Modificare il file:
\Nascite\Prodotti_add.asp
<%@ Language=VBScript %> <html> <link REL="stylesheet" href="../Nozze/include/style.css" type="text/css"> <!--#include file="include/Prodotti_dbconnection.asp"--> <!--#include file="include/Prodotti_variables.asp"--> <!--#include file="include/Prodotti_aspfunctions.asp"--> <body bgcolor=white > <script language="JavaScript" src="../Nozze/include/ts_picker.js"></script> <script language="JavaScript" type="text/javascript" src="../Nozze/include/richtext.js"></script> <form method="POST" action="../Nozze/Prodotti_list.asp" name="frmAdmin"> <input type=hidden id="TargetPageNumber" name="TargetPageNumber" value="<%=Request.Form("TargetPageNumber")%>" > <input type=hidden id="cmdGotoPage" name="cmdGotoPage"> <input type=hidden id=masterkey name=masterkey value="<%=Request.Form("masterkey")%>"> <input type=hidden id=action name=action value="backtolist"> <script language="JavaScript"> <!--#INCLUDE FILE="include/jsfunctions.js"--> function GotoPage(nPageNumber) { document.forms.frmAdmin.cmdGotoPage.value = 'GotoPage'; document.forms.frmAdmin.TargetPageNumber.value = nPageNumber; document.forms.frmAdmin.submit(); } </script> </form> <script language="JavaScript"> //Usage: initRTE(imagesPath, includesPath, cssFile) initRTE("include/images/", "include/", ""); </script> <% 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) if Request.Form("masterkey")<>"" then if InStr(strFields, "Marca")<1 then strFields = strFields & ", " & "Marca" strValues = strValues & ", " & Request.Form("masterkey") end if end if strFields = strFields & ")" strValues = strValues & ")" strSQL = strSQL & strFields & " values " & strValues LogInfo(strSQL) dbConnection.Execute strSQL Call ReportError message="<div class=message><<< Record was added >>></div>" end if sMode = "Add" strSQL="select " 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 "<h1>Add new record</h1>" response.write message response.write "<div align=left><hr width=300 noshade size=1></div>" LogInfo(strSQL) rs.open strSQL, dbConnection Call ReportError Response.write " <a href=Prodotti_list.asp onClick=""GotoPage( " & mypage & "); return false;"">Back to list</a><br><br>" Response.Write "<table cellpadding=2>" %> <form name="editform" method="post" action=Prodotti_add.asp > <input type=hidden id="TargetPageNumber" name="TargetPageNumber" value="<%=Request.Form("TargetPageNumber")%>" > <input type=hidden name=saveid value="<%=HTMLEncode(request.form("editid"))%>"> <input type=hidden name=saveid2 value="<%=HTMLEncode(request.form("editid2"))%>"> <input type=hidden name=saveid3 value="<%=HTMLEncode(request.form("editid3"))%>"> <input type=hidden name=editid value="<%=HTMLEncode(request.form("editid"))%>"> <input type=hidden name=editid2 value="<%=HTMLEncode(request.form("editid2"))%>"> <input type=hidden name=editid3 value="<%=HTMLEncode(request.form("editid3"))%>"> <input type=hidden id=masterkey name=masterkey value="<%=Request.Form("masterkey")%>"> <input type=hidden id=NeedQuotes<%=BuildFieldName(strKeyField)%> name=NeedQuotes<%=BuildFieldName(strKeyField)%> value="<%=Request.Form("NeedQuotes" & BuildFieldName(strKeyField))%>"> <% if strKeyField2<>"" then %> <input type=hidden id=NeedQuotes<%=BuildFieldName(strKeyField2)%> name=NeedQuotes<%=BuildFieldName(strKeyField2)%> value="<%=Request.Form("NeedQuotes" & BuildFieldName(strKeyField2))%>"> <% end if %> <% if strKeyField3<>"" then %> <input type=hidden id=NeedQuotes<%=BuildFieldName(strKeyField3)%> name=NeedQuotes<%=BuildFieldName(strKeyField3)%> value="<%=Request.Form("NeedQuotes" & BuildFieldName(strKeyField3))%>"> <% end if %> <% if strADOXTableName<>"" then set oCat=Nothing %> <!-- buttons --> <tr height=50><td colspan=2 align=center> <input class=button type=submit value="Salva" id=submit1 name=submit1> <input class=button type=reset value="Cancella"> <input type=hidden name=todo value=<%=myaction%>> <input type=hidden name=imagefield value=""> </td></tr> <!-- legend --> <tr height=50><td colspan=2 align=left> <hr width=300 noshade size=1> <!--<img src=images/icon_key.gif> - key field --> <br><img src=../Nozze/images/icon_required.gif> - campo richiesto </td></tr> </table> </form> </body> </html>
[
Íàçàä
]