Modificare il file:
\Buoni_Spesa_2015\Buoni-Spesa-2015-01\RegistraIns.asp
<% @LANGUAGE = VBScript %> <!--#include file="config.asp"--> <% Dim C, D, CN, RS %> <html> <head> <title>Registrazione dati</title> </head> <body> <% ' Recupero i dati dal form C = Request.Form("codice") D = Request.Form("descrizione") ' Mi connetto al database Set Cn = Server.CreateObject("ADODB.Connection") Cn.Open StrCn ' Verifico che i dati da registrare non esistano già Dim SQL SQL = "SELECT * FROM tabella WHERE codice = '" & C & "' AND descrizione = '" & D & "';" Set Rs = Server.CreateObject("ADODB.Recordset") rs.open SQL, cn, 2, 3 If Not rs.EOF Then Response.Write "<p align=""center"">I dati specificati sono già presenti</p>" Else ' Se non esiste, effettuo la registrazione rs.close Rs.Open "tabella", Cn, 2, 3 Rs.AddNew Rs("codice") = C Rs("descrizione") = D Rs.Update Response.Write "<p align=""center"">Registrazione avvenuta con successo!</p>" End If Rs.Close Set Rs = Nothing Cn.Close Set Cn = Nothing With Response .Write "<p align=""center"">" .Write "<a href='home.html'>" .Write "Indietro</a></p>" End With %> </body> </html>
[
Íàçàä
]