Ciao,
sto cercando di fare un update di dati presi da questa form in pagina x:
vorrei permettere all'utente di modificare questi campi, perciò ho creato la pagina update_istituti.asp che contiene la query così:codice:<form name="update" method="post" action="update_istituti.asp"> <% if aggiorna = "si" and IstitutoComune <> "-1" then sql2 = "SELECT * FROM Istituto WHERE IdIstituto = " & IstitutoComune set rs2 = conn.execute(sql2) IstitutoNome = replace(rs2("IstitutoNome"), "'", "''") IstitutoDesc = replace(rs2("IstitutoDesc"), "'", "''") IstitutoPaese = replace(rs2("IstitutoPaese"), "'", "''") response.write("<table align=""center""><tr><td></td><td><input name=""IdIstituto"" type=""hidden"" size=""50"" value=""" & server.HTMLEncode(rs2("IdIstituto")) & """></td></tr>") response.write("<tr><td>Nome</td><td><input name=""IstitutoNome"" type=""text"" size=""50"" value=""" & server.HTMLEncode(rs2("IstitutoNome")) & """></td></tr>") response.write("<tr><td>Descrizione</td><td><input name=""IstitutoDesc"" type=""text"" size=""50"" value=""" & server.HTMLEncode(rs2("IstitutoDesc")) & """></td></tr>") IstitutoVia = rs2("IstitutoVia") if inStr(IstitutoVia,"'") > 0 then IstitutoVia = replace(IstitutoVia, "'", "''") end if response.write("<tr><td>Via</td><td><input name=""IstitutoVia"" type=""text"" size=""50"" value=""" & strIstituto & """></td></tr>") response.write("<tr><td>CAP</td><td><input name='IstitutoCAP' type='text' maxlength='4' size='2' value='" & rs2 ("IstitutoCAP") & " ' onblur='return controllo_CAP();'></td></tr>") response.write("<tr><td>Paese</td><td><input name=""IstitutoPaese"" type=""text"" size=""50"" value=""" & server.HTMLEncode(rs2("IstitutoPaese")) & """></td></tr>") response.write("<tr><td>Telefono</td><td><input name='IstitutoTel' type='text' maxlength='10' size='10' value='" & rs2 ("IstitutoTel") & " ' onblur='return controllo_Tel();'></td></tr></table>") rs2.close set rs2 = nothing end if %> <table align='center'> <tr></tr> <tr> <td> <input type="submit" value="Aggiorna"> </form>
dove connessione.asp è:codice:<% IdIstituto=Request("IdIstituto") IstitutoNome=Request("IstitutoNome") IstitutoDesc=Request("IstitutoDesc") IstitutoVia=Request("IstitutoVia") IstitutoCAP=Request("IstitutoCAP") IstitutoPaese=Request("IstitutoPaese") IstitutoTel=Request("IstitutoTel") sql3 ="UPDATE Istituto SET " & _ "IdIstituto='" & IdIstituto & "', " & _ "IstitutoNome='" & IstitutoNome & "', " & _ "IstitutoDesc='" & IstitutoDesc & "', " & _ "IstitutoVia='" & IstitutoVia & "', " & _ "IstitutoCAP='" & IstitutoCAP & "', " & _ "IstitutoPaese='" & IstitutoPaese & "', " & _ "IstitutoTel=" & IstitutoTel & " " & _ "WHERE IdIstituto='" & IdIstituto & "'" Conn.execute(sql3) Conn.close %> <html> <head> <title>Aggiornamento Completato</title> </head> <body> <h1>Aggiornamento Completato.</h1> </body> </html>
non funziona... non mi trova la pagina... cmq penso che il problema risieda nell'UPDATE... qualche suggerimento?codice:<% Set Conn=Server.CreateObject("ADODB.Connection") strConn="driver={Microsoft Access Driver (*.mdb)}; " strConn=strConn & " DBQ=" & Server.MapPath("DATABASE_DEMO.mdb") strConn=strConn & ";pwd=" & strCode Conn.Open strConn %>
Grazie![]()

Rispondi quotando
