On my webpage for newsletter subscriber, i want to create a way
of informing the user they have subscribed to the newsletter, currently
i am presented with this message;
Error Type:
Microsoft JET Database Engine (0x80040E21)
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.
/new/addsubscribertodb.asp, line 27
this is the code that i am using
Code:
<!-- #include file="ProjectConnection.asp" -->
<!-- METADATA TYPE="typelib"
FILE="c:\Program Files\Common Files\System\ado\msado15.dll" -->
<%
Dim strConnect
%>
<html>
<head>
<title>Add Event</title>
</head>
<body>
<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "Subscriber", strConnect, adOpenKeySet, AdLockOptimistic
objRS.AddNew
objRS.Fields("Subscriber") = Request.Form("txtSubscriber")
objRS.Fields("Username") = Session("Username")
objRS.Update
objRS.Close
Set objRS = Nothing
Response.Redirect "NewsletterConfirmation.asp"
%>
</body>
</html>
Thanks in advance