Allora in realtà io ho anche preso spunto da alcune pagine in asp/jscript che ho già....
in cui però vi sono tre pagine.... aggiungi.html /inseriscipunti.asp /classificapunti.asp
aggiungi.html è quel semplice form che vi ho postato sopra....
in inseriscipunti.asp invece c'è ....
codice:<% Nome = Request.Form("Nome"); Punti = Request.Form("Punti"); //CONTROLLO CHE I CAMPI SIANO STATI COMPILATI CORRETTAMENTE if ((Nome == "") || (Punti == "" )){ // UNO DEI CAMPI OBBLIGATORI E' VUOTO O NON CORRETTO %> <hr color="#808080"> <p align="center"> <font face="Verdana" size="3" color="#00FFFF">Torna indietro e compila tutti i campi correttamente!</font></p> <font face="Verdana" color="#00FFFF">Nome = <%=Nome%></font></p> <font face="Verdana" color="#00FFFF">Punti = <%=Punti%></font></p> <hr color="#808080"> <% } //ALTRIMENTI AGGIUNGE O MODIFICA IL NOME E I PUNTI else{ Conn = Server.CreateObject("ADODB.Connection"); Conn1 = Server.CreateObject("ADODB.Connection"); //APRE LA CONNESSIONE AL DATABASE Conn.Open(url_DB); Conn1.Open(url_DB); //AGGIORNA IL DATABASE, CHIUDE LA CONNESSIONE //E PORTA L'UTENTE NELLA CLASSIFICA RS = Server.CreateObject("ADODB.RecordSet"); SQL="SELECT Nome FROM Classifica WHERE Nome = '"+Nome+"'"; RS = Conn.Execute(SQL); if (RS.EOF) { SQL_Inserisci = "INSERT into Classifica(Nome,Punti) values ('"+Nome+"',"+Punti+")"; Conn1.Execute(SQL_Inserisci); Conn1.Close(); } else { SQL_Update = "Update Classifica SET Punti="+Punti+" WHERE Nome= '"+Nome+"'"; Conn1.Execute(SQL_Update); Conn1.Close(); } Conn.Close(); Response.Redirect("classificapunti.asp"); } %>
in classificapunti.asp invece c'è
codice:<table border="0" width=622 height="396"> <tr> <td valign="top" width="616" height="396"> <p align="center"> <font size="4" face="Verdana" color="#00FFFF">Classifica Punti :</font></p> <% // PERCORSO DEL DATABASE Conn = Server.CreateObject("ADODB.Connection"); Conn.Open(url_DB); RS = Server.CreateObject("ADODB.RecordSet"); // FA LA RICHIESTA AL DATABASE sql = "SELECT * FROM Classifica ORDER BY Punti desc,Nome asc"; %> <% RS= Conn.Execute(sql); // NEMMENO UN DATO INSERITO NELLA CLASSIFICA if (RS.EOF){ %> <p align="center"><font size="2" face="Verdana" color="#00FFFF">Nessun dato inserito nella Classifica!</font></p> <% } else{%> <center> <table border="1" cellpadding="2" cellspacing="2" width="275" bordercolor="#00FFFF" height="1"> <tr> <td width="192" height="1"> <p align="center"><font face="Verdana" color="#00FFFF">Nome</font></td> <td width="50" height="1"> <p align="center"><font face="Verdana" color="#00FFFF">Punti</font></td> </tr> <% while (RS.EOF==0){ %> <tr> <td align="center" width="192" height="1"><font face="Verdana" color="#00FFFF"><%=RS("Nome")%></font></td> <td align="center" width="50" height="1"><font face="Verdana" color="#00FFFF"><%=RS("Punti")%></font></td> </tr> <% // COMPLETA LA VISUALIZZAZIONE DEI DATI NELLA CLASSIFICA E CHIUDE LA CONNESSIONE // AL DATABASE RS.MoveNext(); }//end while } //end if-else RS.Close(); Conn.Close(); %> </table>
A questo punto la mia domanda è, posso convertire tutto in vbscript in modo tale che ci siano solo due pagine ovvero inserisci.asp e classifica.asp??

Rispondi quotando