ho una pagina asp che visualizza alcuni campi di un database
con un pulsante per modificare
i campi sono 7, ma da modificare solo 4.
quando faccio modifica, va tutto bene per due dei 4 campi, mentre 2 dei campi vengono svuotati, cioè viene salvato ""....
mi sembra molto strano
codice:<%@LANGUAGE = VBScript%> <% if Session("Autenticato")<>"OK" then Response.Redirect("../index.html") end if act = request.querystring("act") Dim cn, rs Set cn = Server.CreateObject("ADODB.Connection") cn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("../../data/manage.mdb") Set rs = Server.CreateObject("ADODB.Recordset") if act = "salva" then rs.Open "SELECT * FROM fatture WHERE id = " & request.querystring("id"), cn, 3, 3 rs("ft_acquisto") = request.form("ft_acquisto") rs("€_acquisto") = request.form("€_acquisto") rs("ft_trasporto") = request.form("ft_trasporto") rs("€_trasporto") = request.form("€_trasporto") rs.update rs.close end if rs.Open "SELECT * FROM fatture WHERE id = " & request.querystring("id"), cn, 1 tot_vendita = rs("prezzo") * rs("quantita") guadagno = tot_vendita - rs("€_acquisto") - rs("€_trasporto") %> <html> <head> <title>Dettagli Camion</title> </head> <body> <% if act <>"modifica" then %> <form method="get"> <input type="hidden" name="act" value="modifica"> <input type="hidden" name="id" value="<%=rs("id")%>"> <input type="submit" value="Modifica dati"> </form> <% else %> <form method="post" action="details.asp?act=salva&id=<%=rs("id")%>"> <% end if %> <table border="1" width="58%"> <tr bgcolor="00FFFF><td colspan="4"><h2>Dettagli camion</h2></td></tr> <% if rs("tipo") = "commerciato" then %> <tr bgcolor="00FFFF"> <td colspan="2"><h4>Acquisto</h4></td> <td colspan="2"><h4>Vendita</h4></td> </tr><tr> <td bgcolor="00FFFF" width="25%">Ft. acquisto</td> <td bgcolor = "CCFFFF" width="25%"><% if act <> "modifica" then response.write(rs("ft_acquisto")&"") else response.write("<input type=text name=ft_acquisto size=20 value=" & chr(34)&rs("ft_acquisto")&""&chr(34)& ">") end if %></td> <td bgcolor="00FFFF" width="25">Ft. vendita</td> <td bgcolor = "CCFFFF" width="25%"><%=(rs("numero")&"")%></td> </tr><tr> <td bgcolor="00FFFF" width="25%">€ acquisto</td> <td bgcolor = "CCFFFF" width="25%"><% if act <> "modifica" then response.write(rs("€_acquisto")&"") else response.write("<input type=text name=€_acquisto size=20 value=" & chr(34)&rs("€_acquisto")&""&chr(34)& ">") end if %></td> <td bgcolor="00FFFF" width="25">€ vendita</td> <td bgcolor = "CCFFFF" width="25%"><%=(tot_vendita)%></td> </tr><tr> <td colspan="4"></td> </tr><tr> <td bgcolor="00FFFF" colspan="2"><h4>Trasporto</h4></td> <td bgcolor="00FFFF" colspan="2"><h4>Guadagno</h4></td> </tr><tr> <td bgcolor="00FFFF" width="25%">Ft. trasporto</td> <td bgcolor = "CCFFFF" width="25%"><% if act <> "modifica" then response.write(rs("ft_trasporto")&"") else response.write("<input type=text name=ft_trasporto size=20 value=" & chr(34)&rs("ft_trasporto")&""&chr(34)& ">") end if %></td> <td bgcolor = "CCFFFF" width="50%" colspan="2" rowspan="2"><h4><%=guadagno%></h4></td> </tr><tr> <td bgcolor="00FFFF" width="25">€ trasporto</td> <td bgcolor = "CCFFFF" width="25%"><% if act <> "modifica" then response.write(rs("€_trasporto")&"") else response.write("<input type=text name=€_trasporto size=20 value=" & chr(34)&rs("€_trasporto")&""&chr(34)& ">") end if %></td> </tr> </table> <% if act = "modifica" then %> <input type=submit value=Salva > </form> <% else end if elseif rs("tipo") = "prodotto" then %> <% end if %> </body> </html> <% rs.close cn.close set rs=nothing set cn=nothing %>

Rispondi quotando
