Ciao ragazzi.Ho svilupato questo script per l'inserimento di portate di un ristorante in un db. Il primo inserimento funziona correttamente, ma appena provo a farne un secondo ottengo il seguente errore:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.
error line 140
dov'è il problema?codice:dim cat, categ, nome, prezzo, descr, foto, ingr cat=request.form("cat") nome=request.Form("nome") prezzo=request.Form("prezzo") descr=request.Form("descr") foto=request.Form("foto") ingr=request.Form("ingr") if cat="" or nome="" or descr="" then response.Redirect("ins_piattonuovo_err.asp?cat="&cat&"&nome="&nome&"&prezzo="&prezzo&"&descr="&descr&"&ingr="&ingr&"&foto="&foto&"") end if if cat="ant" then categ="antipasti" elseif cat="primi" then categ="primi" elseif cat="sec" then categ="secondi" elseif cat="dess" then categ="desserts" end if set Conn = Server.CreateObject("ADODB.Connection") strCon = "driver={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath("mdb-database/ristorante.mdb") Conn.open (strCon) sql="INSERT INTO "&categ&" (nome, descr, foto, ingr, prezzo) VALUES ('"&nome&"', '"&descr&"', '"&foto&"', '"&ingr&"', "&prezzo&")" 'l'errore è quiconn.execute sql Conn.close set Conn=nothing response.Write(nome&" >"&"dati aggiornati con successo!")

Rispondi quotando
