Fai così:
codice:
<%
Session.LCID = 1040
function pulisci(stringa)
pulisci = replace(stringa, "'", "|")
end function
strCodiceInterno = Request.Form("CodiceInterno")
strDescrizioneProdotto = pulisci(Request.Form("DescrizioneProdotto"))
strUM = Request.Form("UM")
strsql = "SELECT * FROM TabellaIngredientiSingoli WHERE CodInt = '" & strCodiceInterno & "' and Descrizione = '" & strDescrizioneProdotto & "' "
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open strsql, objconn, 3, 3
if not Rs.Eof and not Rs.Bof then
%>
<script language="javascript">
function NumeroCasuale(Da,A) {
return Math.floor((A-Da+1) * Math.random() +Da);
}
alert("Il Codice Interno: <%=strCodiceInterno%> o la Descrizione prodotto: <%=strDescrizioneProdotto%> risultano già registrati.\nRegistrazione non eseguita.");
location.href="default.asp?nocache="+NumeroCasuale(1,99999);
</script>
<%
rs.close
set rs = nothing
else
sql0 = "INSERT INTO TabellaIngredientiSingoli (CodInt, Descrizione, UM) values ('"&strCodiceInterno&"', '"&strDescrizioneProdotto&"', '"&strUM&"')"
objCONN.execute (Sql0)
%>
<script language="javascript">
function NumeroCasuale(Da,A) {
return Math.floor((A-Da+1) * Math.random() +Da);
}
alert("Registrazione eseguita correttamente.");
location.href="default.asp?nocache="+NumeroCasuale(1,99999);
</script>
<% end if %>