Ciao, perchè questo codice che dovrebbe controllare l'esistenza di un valore nel db non funziona, nel senso che qualunque cosa cerco di registrare (esistente o no nella tabella) dice sempre che il record esiste ?Dove sbaglio?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 "TabellaIngredientiSingoli", objconn, 3, 3 if NOT Rs.Eof and NOT Rs.Bof then response.write "<font face='verdana' size='2' color='#FF0000'>Il valore " & strCodiceInterno & " o il Valore " & strDescrizioneProdotto & " risultano già registrati </font>" rs.close set rs = nothing else sql0 = "INSERT INTO TabellaIngredientiSingoli (CodInt, Descrizione, UM) values ('"&strCodiceInterno&"', '"&strDescrizioneProdotto&"', '"&strUM&"')" objCONN.execute (Sql0) %> <script language="javascript"> alert("Registrazione eseguita correttamente."); window.location.href("default.asp"); </script> <% end if %>

Rispondi quotando