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!