%@ 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=" " 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 "