473,396 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

prevent duplicate submissions to a database from an ASP form

I need help ASAP. I have a form where users can fill out the fields
firstname, lastname, and emailaddress. When the user submits the form,
I need ASP to call out to a SQL Server database to see if the
firstname, lastname and emailaddress the user submitted already exists
in the database. If they all do exist, the user should not be allowed
to submit the data but should be redirected to a page saying "sorry,
you have already entered that information" or something to that effect.

Thanks!

Jul 28 '05 #1
1 1971
First name, last name, ~and~ e-mail? Typically an e-mail address by itself
is all you'd want to use. By checking all three, that would mean I could
register on your site as many times as I like with the same e-mail address.
All I'd have to do is change my name each time. But, I'm not your father.

Dim oADO, oRS, sSQL
Dim sFirstname, sLastname, sEmail

sFirstname = Request.Form("firstname")
sLastname = Request.Form("lastname")
sEmail = Request.Form("email")
sSQL = "SELECT email FROM yourtable WHERE Lastname=" & dbIn(sLastname) & "
AND Firstname=" & dbIn(sFirstname) & " AND Email=" & dbIn(sEmail)

Set oADO = CreateObject("ADODB.Connection")
oADO.Open yourConnectionstring
Set oRS = oADO.Execute(sSQL)
If oRS.EOF Then
''fine, not an exact match, insert the data next
Else
Response.Write "You exist."
End If
oRS.Close : Set oRS = Nothing
oADO.Close : Set oADO = Nothing
Function dbIn(s)
dbIn = "'" & Replace(s, "'", "''") & "'"
End Function
Ray at home

"Sandra G" <gr*******@yahoo.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
I need help ASAP. I have a form where users can fill out the fields
firstname, lastname, and emailaddress. When the user submits the form,
I need ASP to call out to a SQL Server database to see if the
firstname, lastname and emailaddress the user submitted already exists
in the database. If they all do exist, the user should not be allowed
to submit the data but should be redirected to a page saying "sorry,
you have already entered that information" or something to that effect.

Thanks!

Jul 28 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: entoone | last post by:
I have an html form, that has fields and when the submit button is pressed, the information is transferred to a php file. Which then inserts the data into my sql database. How can I go about...
5
by: bissatch | last post by:
Hi, I have been trying to come up with an idea to reduce double submissions where a user clicks refresh and, for example, another row is INSERT into a table. Originally, I would have a form...
9
by: Catherine Jo Morgan | last post by:
Can I set it up so that a certain combination of fields can't contain the same entries, on another record? e.g. a combination of FirstName/LastName/address? Or FirstName/LastName/phone? Or...
2
by: techfuzz | last post by:
I scoured this group and others looking for the best way to disable a button after the first click to prevent multiple submissions, but never did find anything that worked like they said it would. ...
6
by: Oleg Konovalov | last post by:
Hi, I have a Java/JavaScript GUI application where I perform a lot of long DB operations , which takes 5-60 secs to perform. Sometimes user double-clicks the button or just gets impatient and...
1
by: Andy | last post by:
My application is written in .NET (C#) with the inline Edit mode from DataGrid. When a SAVE button is pressed it will perform a action on the database either to add, edit or delete data that a user...
11
by: ariel81 | last post by:
i have created a function to input data from four textboxes into a table. how do i prevent duplicate records of the same mth/Yr into the table? editing of the data in the table with reference to the...
4
by: =?Utf-8?B?QXNhZg==?= | last post by:
Hi, How can I prevent from an ASP.NET page to resend all the data again when the user press the Refresh button or F5 on the browser? Thanks in advanced, Asaf
4
by: jbrumbau | last post by:
Hello, I have been successfully using a database I've created for several months to populate an equipment list for a project we've been working on. However, the form has recently stopped working...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.