se può servire inserisco tutto il codice della pagina
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/conn_utenti.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
If (CStr(Request("MM_update")) = "form_utente") Then
If (Not MM_abortEdit) Then
' execute the update
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_conn_utenti_STRING
MM_editCmd.CommandText = "UPDATE tab_utenti SET username = ?, password = ?, nome = ?, cognome = ?, email = ?, box = ?, scatola = ? WHERE id = ?"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("username")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, Request.Form("password")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, Request.Form("nome")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 50, Request.Form("cognome")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 50, Request.Form("email")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 5, 1, 1, MM_IIF(Request.Form("box"), 1, 0)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 5, 1, 1, MM_IIF(Request.Form("scatola"), 1, 0)) ' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 5, 1, -1, MM_IIF(Request.Form("MM_recordId"), Request.Form("MM_recordId"), null)) ' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "benvenuto.asp"
If (Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
Response.Redirect(MM_editRedirectUrl)
End If
End If
%>
<%
Dim rs_utenti__MMColParam
rs_utenti__MMColParam = "1"
If (Session("MM_username") <> "") Then
rs_utenti__MMColParam = Session("MM_username")
End If
%>
<%
Dim rs_utenti
Dim rs_utenti_cmd
Dim rs_utenti_numRows
Set rs_utenti_cmd = Server.CreateObject ("ADODB.Command")
rs_utenti_cmd.ActiveConnection = MM_conn_utenti_STRING
rs_utenti_cmd.CommandText = "SELECT * FROM tab_utenti WHERE username = ?"
rs_utenti_cmd.Prepared = true
rs_utenti_cmd.Parameters.Append rs_utenti_cmd.CreateParameter("param1", 200, 1, 50, rs_utenti__MMColParam) ' adVarChar
Set rs_utenti = rs_utenti_cmd.Execute
rs_utenti_numRows = 0
%>
<html>
<head>
<title>Modifica dei dati dell'utente</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form_utente" method="POST" action="<%=MM_editAction%>">
<p>
<input type="text" name="username" value="<%=(rs_utenti.Fields.Item("username").Value)%>">
username</p>
<p>
<input type="text" name="password" value="<%=(rs_utenti.Fields.Item("password").Value)%>">
password</p>
<p>
<input type="text" name="nome" value="<%=(rs_utenti.Fields.Item("nome").Value)%>">
nome </p>
<p>
<input type="text" name="cognome" value="<%=(rs_utenti.Fields.Item("cognome").Value)%>">
cognome</p>
<p>
<input type="text" name="email" value="<%=(rs_utenti.Fields.Item("email").Value)%>">
email</p>
<p><%=(rs_utenti.Fields.Item("sesso").Value)%>
<input <%If (CStr((rs_utenti.Fields.Item("sesso").Value)) = CStr("True")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="sesso" type="checkbox" id="sesso" value="On">
sesso</p>
<p>
<input <%If (CStr((rs_utenti.Fields.Item("box").Value)) = CStr("1")) Then Response.Write("checked=""checked""") : Response.Write("checked=""""")%> name="box" type="checkbox" id="box" value="<%=(rs_utenti.Fields.Item("box").Value)%>">
box<p>
<% If (rs_utenti.Fields.Item("box").Value) = "1" Then
Response.Write "yes"
Else Response.Write "no"
End If%>
</p>
sempre
<input <%If (CStr((rs_utenti.Fields.Item("scatola").Value)) = CStr("1")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="scatola" type="checkbox" value="1">
<%=(rs_utenti.Fields.Item("scatola").Value)%>
<p>
<input type="submit" name="Submit" value="Aggiorna i dati">
</p>
<input type="hidden" name="MM_update" value="form_utente">
<input type="hidden" name="MM_recordId" value="<%= rs_utenti.Fields.Item("id").Value %>">
</form>
</body>
</html>
<%
rs_utenti.Close()
%>