Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Preventing Duplicate Entries

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,27284
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Preventing Duplicate Entries
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Preventing Duplicate Entries - 10/24/2005 3:42:44 PM   
  funkdrmr

 

Posts: 1
Score: 0
Joined: 10/24/2005
Status: offline
Hi everyone.  I know this can't be too hard of a question, but I'm really new with ASP and I've been searching to no avail on this problem for the past couple of hours already.

I have a form on a website where people can sign up for a mailing list.  The database is named mailinglist.mdb, the table the data goes to is BOOK1.  Everything works great as far as getting the data into the database (Access).  What I would like to do, is keep people from signing up multiple times with the same email address.  I have an "EMAIL" field in the db that I made a primary key, and this really does exactly what I want it to...preventing the duplicate entry.  However, it spits out the following error.


Microsoft OLE DB Provider for ODBC Drivers error '80040e2f'

How can I change this so the user sees something like "The email address you have entered has already been registered.  Please try another", and where in my code do I need to place it?

Thanks in advance for any help.
 
 
Post #: 1
 
 RE: Preventing Duplicate Entries - 11/28/2005 9:30:56 AM   
  csamuels


Posts: 42
Score: 0
Joined: 9/26/2005
Status: offline
before you run the insert statement, search the table for the email address

run select emailfield from book1 where emailfield = '*get data*'

if rs.eof then
response.write "email address already found"
else
'put your insert code here
end if

(in reply to funkdrmr)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Preventing Duplicate Entries Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts