leggendo la guida http://asp.html.it/guide/lezione/2040/inserimento-dati/
o provato a fare una prova mettendo il codice asp ed il form nella stessa pagina:
però non funziona e non succede nulla. mi dice "The page cannot be displayed "codice:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>Prova</title> </head> <body> <form method="POST" action=""> <p align="center"> <input type="text" name="titolo" size="20"> <input type="text" name="autore" size="20"> <select size="1" name="genere"> <option>Narrativa</option> <option>Horror</option> <option>Thriller</option> <option>Giallo</option> </select></p> <p align="center"><input type="submit" value="Invia" name="B1"><input type="reset" value="Reimposta" name="B2"></p> </form> <% ' Definizione della variabile dim strTitolo strTitolo = request.form("titolo") dim strAutore strAutore = request.form("autore") dim strGenere strGenere = request.form("genere") dim strCode strCode="innovatel" ' Mappaggio del database Set Conn=Server.CreateObject("ADODB.Connection") strConn="driver={Microsoft Access Driver (*.mdb)}; " strConn=strConn & " DBQ=" & Server.MapPath("libreria.mdb") strConn=strConn & ";pwd=" & strCode Conn.Open strConn ' Stringa di interrogazione sulla tabella libri sql = "SELECT * FROM libri" Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sql, conn ,3,3 ' Preparazione e scrittura nuovo record rs.addnew rs(1) = strTitolo rs(2) = strAutore rs(3) = strGenere rs.update ' Chiusura del database rs.Close set rs = Nothing conn.Close set conn = Nothing %> </body> </html>
Come e dove correggere?

Rispondi quotando