Modifica record in DB Access
dovrei riuscire a modificare dei records nel solito database ma mi da errore, vi posto il codice della pagina modifica e l'errore:
CODICE:
<%@LANGUAGE = JScript%>
<!--#include file="config.inc"-->
<%
var id = parseInt(Request.QueryString("id"));
if (isNaN(id))
{
Response.Redirect("index.asp");
}
var Rs = Cn.Execute("SELECT * FROM Utenti WHERE id = " + id);
var azione = new String(Request.QueryString("azione"));
%>
<html>
<head>
<title>Modifica i dati</title>
<style type="text/css">
td, p { font: Normal 12px Verdana; }
a { color: #0000FF; }
a:hover { color: #FF0000; }
</style>
</head>
<body>
<table align="center" width="400" cellpadding="1" cellspacing="0" border="1">
<form method="POST" action="modifica.asp?id=<%=id%>&azione=UPD">
<tr>
<td colspan="2"><b>Modifica i dati </b></td>
</tr>
<tr>
<td width="150">Nome</td>
<td width="250"><input type="text" name="nome" maxlength="50" style="width: 100%;" value="<%=Rs("nome")%>"></td>
</tr>
<tr>
<td>Cognome</td>
<td><input type="text" name="anno" maxlength="50" style="width: 100%;" value="<%=Rs("anno")%>"></td>
</tr>
<tr>
<td>E_hamann</td>
<td><input type="text" name="hamann" maxlength="50" style="width: 100%;" value="<%=Rs("hamann")%>"></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" value="Modifica"></td>
</tr>
<tr>
<td><a href="index.asp">Leggi</a></td>
<td align="right"></td>
</tr>
</form>
</table>
<%
if (azione== "UPD")
{
var nome = new String(Request.Form("nome"));
var anno = new String(Request.Form("anno"));
var hamann = new String(Request.Form("hamann"));
if (nome == "" || anno == "" || hamann == "")
{
Response.Redirect("modifica.asp?id=" + id);
}
else
{
var r_nome = nome.replace(/'/g,"''");
var r_anno = anno.replace(/'/g,"''");
var r_hamann = hamann.replace(/'/g,"''");
Cn.Execute("UPDATE Utenti SET nome = '" + r_nome + "', anno = '" + r_anno + "', e_hamann = '" + r_hamann + "' WHERE id = " + id);
Cn.Close();
Response.Write("<p align=\"center\">Modifica effettuata!</p>");
}
}
%>
</body>
</html>
l'errore è il seguente:
Impossibile visualizzare la pagina
Si è verificato un problema a livello della pagina che si desidera visualizzare che ne impedisce la visualizzazione.
--------------------------------------------------------------------------------
Please try the following:
Fare clic sul pulsante Aggiorna o riprovare più tardi.
Aprire la localhost home page e cercare i collegamenti alle informazioni desiderate.
HTTP 500.100 - Errore interno del server - errore ASP
Internet Information Services
--------------------------------------------------------------------------------
Informazioni tecniche (per il personale del supporto tecnico)
Tipo di errore:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][Driver ODBC Microsoft Access] Parametri insufficienti. Previsto 1.
/registrazione_modulo/modifica.asp, line 69
Tipo di browser:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
Pagina:
POST 26 bytes to /registrazione_modulo/modifica.asp
POST Data:
nome=uu&anno=2009&hamann=u
Ora:
domenica 20 dicembre 2009, 15.38.23
Informazioni aggiuntive:
Supporto Microsoft
LA LINEA 69 E' QUESTA:
Cn.Execute("UPDATE Utenti SET nome = '" + r_nome + "', anno = '" + r_anno + "', e_hamann = '" + r_hamann + "' WHERE id = " + id);
GRAZIE A TUTTI IN ANRICIPO ;-)