Compare two items

S

Stupid verifcation

I have this login that i created. On the sign in process i need to make sure
that no one has already signed up using that certain email or that unique
cnumber.

Ive tried this line:
Set objRS = verify.execute("SELECT id FROM logmein WHERE email='" & email &
"'") or ("', cnumber= '" & cnumber & "';")

than this:
Set objRS = verify.execute("SELECT id FROM logmein WHERE email='" & email &
"'", "' & or & '", "' cnumber= '" & cnumber & "';")


Anyone know what i did wrong?
 
S

Steven Burn

Set objRS = verify.execute("SELECT id FROM logmein WHERE email='" & email &
"' AND cnumber= '" & cnumber & "'"

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
R

Ray Costanzo [MVP]

Hello Stupid <g>,

Is there something that is making you think that you did something wrong,
i.e. an error message? It looks like you've having issues with
concatenation. Dealing with the task at hand, it appears that your goal is
to have your SQL querystring look like this, where I entered values of
(e-mail address removed) and JoesCNumber.

s = "SELECT id FROM logmein WHERE email = '(e-mail address removed)' or cnumber =
'JoesCNumber'"

So, to get the variable values in there, replace the literal strings above
with
" & varName & "

s = "SELECT id FROM logmein WHERE email = '" & email & "' or cnumber = '" &
cnumber & "'"

Ray at home
 
A

Athmaus

Ive tried that and i get the same errror i get with using or

Incorrect syntax near the keyword cnumber.
 
A

Athmaus

Yes,

Sorry i have done all of the form inputs. I have all of the input stuff in
there already as well as other verifciaton.

This login was finished a month ago, but we are going to start using this
week, and i needed to add some additional comparision things to make sure
people wernet sharing their cnumbers with anyone else and have them login,
and to make sure no one logs in with same email addy.
 
R

Ray Costanzo [MVP]

What is the error message that you receive when using the query that I
provided? We need to see more code and your error!

Ray at home
 
A

Athmaus

here is the entire ASP code of that page: (i left out all of the form stuff
unless you went taht as well).

<%
Function SendEmail()

Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & NL
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<title>Login Information</title>"
HTML = HTML & "</head>"
HTML = HTML & "<center><b>Login Information</b></center>"
HTML = HTML & "<br>Dear: " & Request.Form("fname") & " " &
Request.Form("lname")
HTML = HTML & "<br> <b>User Name: </b>" & Request.Form("email")
HTML = HTML & "<br> <b>Password: </b>" & Request.Form("password")
HTML = HTML & "</body>"
HTML = HTML & "</html>"

myMail.From = "(e-mail address removed)"
myMail.To = Request.Form("email")
myMail.Subject = "Login Information"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send
End Function
%>

<%
Response.Expires = -1000 'Make sure the browser doesnt cache this page
Response.Buffer = True 'enables our response.redirect to work

If Request.Form("valuepassed") ="true" Then
CheckSignUpForm
Else
ShowSignUpForm
End If

Sub CheckSignUpForm
Dim myconn, verify, blnLoggedIn, first, last, email, cnumber, user, pass,
site, logged, objRS, information

Set verify = Server.CreateObject("ADODB.Connection")
verify.open = "Provider=SQLOLEDB.1;Password=xxx;Persist Security
Info=True;User ID=xxxx;Initial Catalog=xxx;Data Source=xxx"


first = Request.Form("fname")
last = Request.Form("lname")
email = Request.Form("email")
cnumber = Request.Form("cnumber")
'user = Request.Form("username")
pass = Request.Form("password")
site = 1
logged = 0

Set objRS = verify.execute("SELECT id FROM regfreeup WHERE email='" & email
& "'") or ("' cnumber = '" & cnumber & "';")
'Set objRS = verify.execute("SELECT id FROM logmein WHERE username='" &
user & "' OR cnumber ='" & cnumber & "';")
If objRS.EOF Then '''NO RECORDS MATCH. PROCEED WITH LOGIN CREATION
blnLoggedIn = False

information = "INSERT INTO logmein (cnumber, firstname, lastname, email,
pass, site, signup, logged) VALUES('" & cnumber & "', '" & first & "', '" &
last & "', '" & email & "', '" & pass & "', '" & site & "', '" & Now() & "',
'" & logged & "')"
Set Recordset = verify.execute(information)
SendEmail()
Response.Redirect "http://www.yahoo.com"
Else
Response.Redirect "http://www.google.com"
End If

verify.close
set verify = nothing


ShowSignUpForm
End Sub

%>

<% Sub ShowSignUpForm %>
 
R

Ray Costanzo [MVP]

Again, what is the error?

Athmaus said:
here is the entire ASP code of that page: (i left out all of the form
stuff
unless you went taht as well).

<%
Function SendEmail()

Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & NL
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<title>Login Information</title>"
HTML = HTML & "</head>"
HTML = HTML & "<center><b>Login Information</b></center>"
HTML = HTML & "<br>Dear: " & Request.Form("fname") & " " &
Request.Form("lname")
HTML = HTML & "<br> <b>User Name: </b>" & Request.Form("email")
HTML = HTML & "<br> <b>Password: </b>" & Request.Form("password")
HTML = HTML & "</body>"
HTML = HTML & "</html>"

myMail.From = "(e-mail address removed)"
myMail.To = Request.Form("email")
myMail.Subject = "Login Information"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send
End Function
%>

<%
Response.Expires = -1000 'Make sure the browser doesnt cache this page
Response.Buffer = True 'enables our response.redirect to work

If Request.Form("valuepassed") ="true" Then
CheckSignUpForm
Else
ShowSignUpForm
End If

Sub CheckSignUpForm
Dim myconn, verify, blnLoggedIn, first, last, email, cnumber, user, pass,
site, logged, objRS, information

Set verify = Server.CreateObject("ADODB.Connection")
verify.open = "Provider=SQLOLEDB.1;Password=xxx;Persist Security
Info=True;User ID=xxxx;Initial Catalog=xxx;Data Source=xxx"


first = Request.Form("fname")
last = Request.Form("lname")
email = Request.Form("email")
cnumber = Request.Form("cnumber")
'user = Request.Form("username")
pass = Request.Form("password")
site = 1
logged = 0

Set objRS = verify.execute("SELECT id FROM regfreeup WHERE email='" &
email
& "'") or ("' cnumber = '" & cnumber & "';")
'Set objRS = verify.execute("SELECT id FROM logmein WHERE username='" &
user & "' OR cnumber ='" & cnumber & "';")
If objRS.EOF Then '''NO RECORDS MATCH. PROCEED WITH LOGIN CREATION
blnLoggedIn = False

information = "INSERT INTO logmein (cnumber, firstname, lastname, email,
pass, site, signup, logged) VALUES('" & cnumber & "', '" & first & "', '"
&
last & "', '" & email & "', '" & pass & "', '" & site & "', '" & Now() &
"',
'" & logged & "')"
Set Recordset = verify.execute(information)
SendEmail()
Response.Redirect "http://www.yahoo.com"
Else
Response.Redirect "http://www.google.com"
End If

verify.close
set verify = nothing


ShowSignUpForm
End Sub

%>

<% Sub ShowSignUpForm %>
 
A

Athmaus

sorry here it is:

Microsoft OLE DB Provider for SQL Server error '80040e14'

Incorrect syntax near the keyword 'order'.
 
A

Athmaus

It is the exact same line that i posted in the first post, that has not
changed.......

Set objRS = verify.execute("SELECT id FROM regfreeup WHERE email='" & email
& "'") or ("' cnumber = '" & cnumber & "';")

By order i mean cnumber, sorry bout that
 
R

Ray Costanzo [MVP]

Athmaus said:
It is the exact same line that i posted in the first post, that has not
changed.......

See Steve Burn's response from a couple of hours ago.

Set objRS = verify.execute("SELECT id FROM regfreeup WHERE email='" &
email
& "'") or ("' cnumber = '" & cnumber & "';")

By order i mean cnumber, sorry bout that

Any time you're posting code or an error or anything else that can help us
help you, please copy and paste it as opposed to retyping it. Also, when in
doubt, do a

REPSONSE.WRITE yourSQLString
RESPONSE.END

What does that look like? Can you paste that into Query Analyzer and run
it? If not, can you see why not?

Also, in order to get help more easily, indicate what line the error is
occurring on. This thread could have gone like this:

========Athmaus
I'm getting this error:
Microsoft OLE DB Provider for SQL Server error '80040e14'

Incorrect syntax near the keyword 'order'.

with this code snippet:
Set verify = Server.CreateObject("ADODB.Connection")
verify.open = "Provider=SQLOLEDB.1;Password=xxx;Persist Security
Info=True;User ID=xxxx;Initial Catalog=xxx;Data Source=xxx"

'''vvvv This line causes the error
Set objRS = verify.execute("SELECT id FROM regfreeup WHERE email='" & email
& "'") or ("' cnumber = '" & cnumber & "';")


========Steve Burn
You're missing a ) at the end of your query. Response.Write the string to
see.


========Bob Barrows
Use stored procedures.

Ray at home
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top