Hi guys, i have an application i'm working on that will add items to an access database. The INSERT Works fine until i try to insert something that's already been inserted, then i get this error
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[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.
/Telmon/Intranet/PSS_Old2/InsertMaterial.asp, line 24
here's the code i'm using for the insert.
<%
Session("Qty"
= Request("Qty"
Session("ProductID"
= Request.Form("ProductID"
Session("JobCode"
= Request("JobCode"
JobCode = Session("JobCode"
qty = Session("Qty"
prodID = Session("ProductID"
strSQL = "INSERT INTO Orders (ProductID, JobCode, Quantity) VALUES (" & prodID & ", " & JobCode & ", " & qty & "
"
Set cnMat = Server.CreateObject("ADODB.Connection"
cnMat.Open "DSN=PSS"
cnMat.Execute(strSQL)
Response.Redirect "DisplayQty.asp?JobCode=" & JobCode & "&ProductID=" & prodID
cnMat.Close
Set cnMat = Nothing
%>
Thanks in advance.
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[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.
/Telmon/Intranet/PSS_Old2/InsertMaterial.asp, line 24
here's the code i'm using for the insert.
<%
Session("Qty"
Session("ProductID"
Session("JobCode"
JobCode = Session("JobCode"
qty = Session("Qty"
prodID = Session("ProductID"
strSQL = "INSERT INTO Orders (ProductID, JobCode, Quantity) VALUES (" & prodID & ", " & JobCode & ", " & qty & "
Set cnMat = Server.CreateObject("ADODB.Connection"
cnMat.Open "DSN=PSS"
cnMat.Execute(strSQL)
Response.Redirect "DisplayQty.asp?JobCode=" & JobCode & "&ProductID=" & prodID
cnMat.Close
Set cnMat = Nothing
%>
Thanks in advance.